﻿namespace dataSendDal.DBLinq
{
    using System;
    using System.ComponentModel;
    using System.Data;
#if MONO_STRICT
	using System.Data.Linq;
#else   // MONO_STRICT
    using DbLinq.Data.Linq;
    using DbLinq.Vendor;
#endif  // MONO_STRICT
    using System.Data.Linq.Mapping;
    using System.Diagnostics;
    using dataSendDal.Util;


    public partial class SchoolBus : DataContext
    {

        #region Extensibility Method Declarations
        partial void OnCreated();
        #endregion


        public SchoolBus(string connectionString) :
            base(connectionString)
        {
            this.OnCreated();
        }

        public SchoolBus(string connection, MappingSource mappingSource) :
            base(connection, mappingSource)
        {
            this.OnCreated();
        }

        public SchoolBus(IDbConnection connection, MappingSource mappingSource) :
            base(connection, mappingSource)
        {
            this.OnCreated();
        }

        public Table<CsFunction> CsFunction
        {
            get
            {
                return this.GetTable<CsFunction>();
            }
        }

        public Table<CsFunPermission> CsFunPermission
        {
            get
            {
                return this.GetTable<CsFunPermission>();
            }
        }

        public Table<CsRole> CsRole
        {
            get
            {
                return this.GetTable<CsRole>();
            }
        }
        public Table<CsRolePermission> CsRolePermission
        {
            get
            {
                return this.GetTable<CsRolePermission>();
            }
        }
        public Table<CsUserRole> CsUserRole
        {
            get
            {
                return this.GetTable<CsUserRole>();
            }
        }
        public Table<TAlarmLevel> TAlarmLevel
        {
            get
            {
                return this.GetTable<TAlarmLevel>();
            }
        }

        public Table<TAlarmLevelPlan> TAlarmLevelPlan
        {
            get
            {
                return this.GetTable<TAlarmLevelPlan>();
            }
        }

        public Table<TAlarmPlan> TAlarmPlan
        {
            get
            {
                return this.GetTable<TAlarmPlan>();
            }
        }

        public Table<TAlarmRecord> TAlarmRecord
        {
            get
            {
                return this.GetTable<TAlarmRecord>();
            }
        }

        public Table<TAlarmType> TAlarmType
        {
            get
            {
                return this.GetTable<TAlarmType>();
            }
        }

        public Table<TAttendants> TAttendants
        {
            get
            {
                return this.GetTable<TAttendants>();
            }
        }

        public Table<TAttendantsCardOwner> TAttendantsCardOwner
        {
            get
            {
                return this.GetTable<TAttendantsCardOwner>();
            }
        }

        public Table<TBus> TBus
        {
            get
            {
                return this.GetTable<TBus>();
            }
        }

        public Table<TBusStaffMan> TBusStaffMan
        {
            get
            {
                return this.GetTable<TBusStaffMan>();
            }
        }

        public Table<TCard> TCard
        {
            get
            {
                return this.GetTable<TCard>();
            }
        }

        public Table<TCardReader> TCardReader
        {
            get
            {
                return this.GetTable<TCardReader>();
            }
        }

        public Table<TCardType> TCardType
        {
            get
            {
                return this.GetTable<TCardType>();
            }
        }

        public Table<TDriver> TDriver
        {
            get
            {
                return this.GetTable<TDriver>();
            }
        }

        public Table<TDriverCardOwner> TDriverCardOwner
        {
            get
            {
                return this.GetTable<TDriverCardOwner>();
            }
        }

        public Table<TDriverCardType> TDriverCardType
        {
            get
            {
                return this.GetTable<TDriverCardType>();
            }
        }

        public Table<TFrontEquipment> TFrontEquipment
        {
            get
            {
                return this.GetTable<TFrontEquipment>();
            }
        }

        public Table<TFunctionInfo> TFunctionInfo
        {
            get
            {
                return this.GetTable<TFunctionInfo>();
            }
        }

        public Table<TGivenClass> TGivenClass
        {
            get
            {
                return this.GetTable<TGivenClass>();
            }
        }

        public Table<TLocateData> TLocateData
        {
            get
            {
                return this.GetTable<TLocateData>();
            }
        }

        public Table<TLog> TLog
        {
            get
            {
                return this.GetTable<TLog>();
            }
        }

        public Table<TMonitorType> TMonitorType
        {
            get
            {
                return this.GetTable<TMonitorType>();
            }
        }

        public Table<TOldLocateData> TOldLocateData
        {
            get
            {
                return this.GetTable<TOldLocateData>();
            }
        }

        public Table<TOldReadersTate> TOldReadersTate
        {
            get
            {
                return this.GetTable<TOldReadersTate>();
            }
        }

        public Table<TOrder> TOrder
        {
            get
            {
                return this.GetTable<TOrder>();
            }
        }

        public Table<TOrganization> TOrganization
        {
            get
            {
                return this.GetTable<TOrganization>();
            }
        }

        public Table<TOrGType> TOrGType
        {
            get
            {
                return this.GetTable<TOrGType>();
            }
        }

        public Table<TParentCardOwner> TParentCardOwner
        {
            get
            {
                return this.GetTable<TParentCardOwner>();
            }
        }

        public Table<TParents> TParents
        {
            get
            {
                return this.GetTable<TParents>();
            }
        }

        public Table<TParentsStu> TParentsStu
        {
            get
            {
                return this.GetTable<TParentsStu>();
            }
        }

        public Table<TPrivilege> TPrivilege
        {
            get
            {
                return this.GetTable<TPrivilege>();
            }
        }

        public Table<TReader> TReader
        {
            get
            {
                return this.GetTable<TReader>();
            }
        }

        public Table<TReadersTate> TReadersTate
        {
            get
            {
                return this.GetTable<TReadersTate>();
            }
        }

        public Table<TResource> TResource
        {
            get
            {
                return this.GetTable<TResource>();
            }
        }

        public Table<TResourcePRiViILegE> TResourcePRiViILegE
        {
            get
            {
                return this.GetTable<TResourcePRiViILegE>();
            }
        }

        public Table<TRole> TRole
        {
            get
            {
                return this.GetTable<TRole>();
            }
        }

        public Table<TRolePrivilege> TRolePrivilege
        {
            get
            {
                return this.GetTable<TRolePrivilege>();
            }
        }

        public Table<TStaff> TStaff
        {
            get
            {
                return this.GetTable<TStaff>();
            }
        }

        public Table<TStaffType> TStaffType
        {
            get
            {
                return this.GetTable<TStaffType>();
            }
        }

        public Table<TStudent> TStudent
        {
            get
            {
                return this.GetTable<TStudent>();
            }
        }

        public Table<TStudentCardOwner> TStudentCardOwner
        {
            get
            {
                return this.GetTable<TStudentCardOwner>();
            }
        }

        public Table<TTeacher> TTeacher
        {
            get
            {
                return this.GetTable<TTeacher>();
            }
        }

        public Table<TTeacherCardOwner> TTeacherCardOwner
        {
            get
            {
                return this.GetTable<TTeacherCardOwner>();
            }
        }

        public Table<TUser> TUser
        {
            get
            {
                return this.GetTable<TUser>();
            }
        }

        public Table<TUserOrG> TUserOrG
        {
            get
            {
                return this.GetTable<TUserOrG>();
            }
        }

        public Table<TUserPrivilege> TUserPrivilege
        {
            get
            {
                return this.GetTable<TUserPrivilege>();
            }
        }

        public Table<TUserRole> TUserRole
        {
            get
            {
                return this.GetTable<TUserRole>();
            }
        }

        public Table<TUserType> TUserType
        {
            get
            {
                return this.GetTable<TUserType>();
            }
        }
    }

    #region Start MONO_STRICT
#if MONO_STRICT

	public partial class SchoolBus
	{
		
		public SchoolBus(IDbConnection connection) : 
				base(connection)
		{
			this.OnCreated();
		}
	}
    #region End MONO_STRICT
    #endregion
#else     // MONO_STRICT

    public partial class SchoolBus
    {
        private static MySql.Data.MySqlClient.MySqlConnection MyCon
        {
            get
            {
                string constr = Constants.CONNECTION_STRING;
                return new MySql.Data.MySqlClient.MySqlConnection(constr);
            }
        }
        public SchoolBus() :
            base(MyCon, new DbLinq.MySql.MySqlVendor())
        {
            this.OnCreated();
        }


    }
    #region End Not MONO_STRICT
    #endregion
#endif     // MONO_STRICT
    #endregion
    [Table(Name = "schoolbus.cs_function")]
    public partial class CsFunction : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private string _id;

        private string _key;

        private string _name;
        private string _note;
        private System.Nullable<int> _orderID;

        private string _parentID;

        private string _type;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(string value);

        partial void OnKeyChanged();

        partial void OnKeyChanging(string value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnOrderIDChanged();

        partial void OnOrderIDChanging(System.Nullable<int> value);

        partial void OnParentIDChanged();

        partial void OnParentIDChanging(System.String value);

        partial void OnTypeChanged();

        partial void OnTypeChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public CsFunction()
        {
            this.OnCreated();
        }
        [Column(Storage = "_note", Name = "note", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }
        [Column(Storage = "_code", Name = "code", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "varchar(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if (((_id == value)
                            == false))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_key", Name = "key", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Key
        {
            get
            {
                return this._key;
            }
            set
            {
                if (((_key == value)
                            == false))
                {
                    this.OnKeyChanging(value);
                    this.SendPropertyChanging();
                    this._key = value;
                    this.SendPropertyChanged("Key");
                    this.OnKeyChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_orderID", Name = "orderId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrderID
        {
            get
            {
                return this._orderID;
            }
            set
            {
                if ((_orderID != value))
                {
                    this.OnOrderIDChanging(value);
                    this.SendPropertyChanging();
                    this._orderID = value;
                    this.SendPropertyChanged("OrderID");
                    this.OnOrderIDChanged();
                }
            }
        }

        [Column(Storage = "_parentID", Name = "parentId", DbType = "string", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.String ParentID
        {
            get
            {
                return this._parentID;
            }
            set
            {
                if ((_parentID != value))
                {
                    this.OnParentIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentID = value;
                    this.SendPropertyChanged("ParentID");
                    this.OnParentIDChanged();
                }
            }
        }

        [Column(Storage = "_type", Name = "type", DbType = "char(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Type
        {
            get
            {
                return this._type;
            }
            set
            {
                if (((_type == value)
                            == false))
                {
                    this.OnTypeChanging(value);
                    this.SendPropertyChanging();
                    this._type = value;
                    this.SendPropertyChanged("Type");
                    this.OnTypeChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.cs_fun_permission")]
    public partial class CsFunPermission : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private string _id;

        private string _name;

        private string _value;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(string value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnValueChanged();

        partial void OnValueChanging(string value);
        #endregion


        public CsFunPermission()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "varchar(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if (((_id == value)
                            == false))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_value", Name = "value", DbType = "char(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Value
        {
            get
            {
                return this._value;
            }
            set
            {
                if (((_value == value)
                            == false))
                {
                    this.OnValueChanging(value);
                    this.SendPropertyChanging();
                    this._value = value;
                    this.SendPropertyChanged("Value");
                    this.OnValueChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.cs_role")]
    public partial class CsRole : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _createTime;



        private System.Nullable<System.DateTime> _enabledTime;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnEnabledChanged();

        partial void OnEnabledChanging(System.Nullable<bool> value);

        partial void OnEnabledTimeChanged();

        partial void OnEnabledTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public CsRole()
        {
            this.OnCreated();
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_enabledTime", Name = "enabledTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> EnabledTime
        {
            get
            {
                return this._enabledTime;
            }
            set
            {
                if ((_enabledTime != value))
                {
                    this.OnEnabledTimeChanging(value);
                    this.SendPropertyChanging();
                    this._enabledTime = value;
                    this.SendPropertyChanged("EnabledTime");
                    this.OnEnabledTimeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [Table(Name = "schoolbus.cs_role_permission")]
    public partial class CsRolePermission : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _permissionID;

        private int _roleID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnPermissionIDChanged();

        partial void OnPermissionIDChanging(string value);

        partial void OnRoleIDChanged();

        partial void OnRoleIDChanging(int value);
        #endregion


        public CsRolePermission()
        {
            this.OnCreated();
        }

        [Column(Storage = "_permissionID", Name = "permissionId", DbType = "varchar(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string PermissionID
        {
            get
            {
                return this._permissionID;
            }
            set
            {
                if (((_permissionID == value)
                            == false))
                {
                    this.OnPermissionIDChanging(value);
                    this.SendPropertyChanging();
                    this._permissionID = value;
                    this.SendPropertyChanged("PermissionID");
                    this.OnPermissionIDChanged();
                }
            }
        }

        [Column(Storage = "_roleID", Name = "roleId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RoleID
        {
            get
            {
                return this._roleID;
            }
            set
            {
                if ((_roleID != value))
                {
                    this.OnRoleIDChanging(value);
                    this.SendPropertyChanging();
                    this._roleID = value;
                    this.SendPropertyChanged("RoleID");
                    this.OnRoleIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [Table(Name = "schoolbus.cs_user_role")]
    public partial class CsUserRole : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.DateTime _enabledTime;

        private int _id;

        private int _orleID;

        private int _userID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnEnabledTimeChanged();

        partial void OnEnabledTimeChanging(System.DateTime value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnOrleIDChanged();

        partial void OnOrleIDChanging(int value);

        partial void OnUserIDChanged();

        partial void OnUserIDChanging(int value);
        #endregion


        public CsUserRole()
        {
            this.OnCreated();
        }

        [Column(Storage = "_enabledTime", Name = "enabledTime", DbType = "datetime", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public System.DateTime EnabledTime
        {
            get
            {
                return this._enabledTime;
            }
            set
            {
                if ((_enabledTime != value))
                {
                    this.OnEnabledTimeChanging(value);
                    this.SendPropertyChanging();
                    this._enabledTime = value;
                    this.SendPropertyChanged("EnabledTime");
                    this.OnEnabledTimeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_orleID", Name = "orleId", DbType = "int", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int OrleID
        {
            get
            {
                return this._orleID;
            }
            set
            {
                if ((_orleID != value))
                {
                    this.OnOrleIDChanging(value);
                    this.SendPropertyChanging();
                    this._orleID = value;
                    this.SendPropertyChanged("OrleID");
                    this.OnOrleIDChanged();
                }
            }
        }

        [Column(Storage = "_userID", Name = "userId", DbType = "int", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int UserID
        {
            get
            {
                return this._userID;
            }
            set
            {
                if ((_userID != value))
                {
                    this.OnUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._userID = value;
                    this.SendPropertyChanged("UserID");
                    this.OnUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [Table(Name = "schoolbus.t_alarm_level")]
    public partial class TAlarmLevel : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _id;

        private System.Nullable<int> _level;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnLevelChanged();

        partial void OnLevelChanging(System.Nullable<int> value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TAlarmLevel()
        {
            this.OnCreated();
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_level", Name = "level", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Level
        {
            get
            {
                return this._level;
            }
            set
            {
                if ((_level != value))
                {
                    this.OnLevelChanging(value);
                    this.SendPropertyChanging();
                    this._level = value;
                    this.SendPropertyChanged("Level");
                    this.OnLevelChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_alarm_level_plan")]
    public partial class TAlarmLevelPlan : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _alarmtypeID;

        private int _id;

        private System.Nullable<int> _planID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAlarmtypeIDChanged();

        partial void OnAlarmtypeIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnPlanIDChanged();

        partial void OnPlanIDChanging(System.Nullable<int> value);
        #endregion


        public TAlarmLevelPlan()
        {
            this.OnCreated();
        }

        [Column(Storage = "_alarmtypeID", Name = "alarmtypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmtypeID
        {
            get
            {
                return this._alarmtypeID;
            }
            set
            {
                if ((_alarmtypeID != value))
                {
                    this.OnAlarmtypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._alarmtypeID = value;
                    this.SendPropertyChanged("AlarmtypeID");
                    this.OnAlarmtypeIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_planID", Name = "planId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> PlanID
        {
            get
            {
                return this._planID;
            }
            set
            {
                if ((_planID != value))
                {
                    this.OnPlanIDChanging(value);
                    this.SendPropertyChanging();
                    this._planID = value;
                    this.SendPropertyChanged("PlanID");
                    this.OnPlanIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_alarm_plan")]
    public partial class TAlarmPlan : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TAlarmPlan()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_alarm_record")]
    public partial class TAlarmRecord : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _alarmDetail;

        private System.Nullable<int> _alarmID;

        private string _alarmResult;

        private System.Nullable<int> _alarmTypeID;

        private System.Nullable<int> _busID;

        private System.Nullable<int> _cardID;

        private System.Nullable<System.DateTime> _endTime;

        private int _id;

        private System.Nullable<short> _isDisposed;

        private System.Nullable<System.DateTime> _localeDealDate;

        private System.Nullable<System.DateTime> _localeDealPeople;

        private string _note;

        private System.Nullable<int> _orgID;

        private System.Nullable<int> _readerID;

        private System.Nullable<System.DateTime> _recordTime;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAlarmDetailChanged();

        partial void OnAlarmDetailChanging(string value);

        partial void OnAlarmIDChanged();

        partial void OnAlarmIDChanging(System.Nullable<int> value);

        partial void OnAlarmResultChanged();

        partial void OnAlarmResultChanging(string value);

        partial void OnAlarmTypeIDChanged();

        partial void OnAlarmTypeIDChanging(System.Nullable<int> value);

        partial void OnBusIDChanged();

        partial void OnBusIDChanging(System.Nullable<int> value);

        partial void OnCardIDChanged();

        partial void OnCardIDChanging(System.Nullable<int> value);

        partial void OnEndTimeChanged();

        partial void OnEndTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIsDisposedChanged();

        partial void OnIsDisposedChanging(System.Nullable<short> value);

        partial void OnLocaleDealDateChanged();

        partial void OnLocaleDealDateChanging(System.Nullable<System.DateTime> value);

        partial void OnLocaleDealPeopleChanged();

        partial void OnLocaleDealPeopleChanging(System.Nullable<System.DateTime> value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(System.Nullable<int> value);

        partial void OnRecordTimeChanged();

        partial void OnRecordTimeChanging(System.Nullable<System.DateTime> value);
        #endregion


        public TAlarmRecord()
        {
            this.OnCreated();
        }

        [Column(Storage = "_alarmDetail", Name = "alarmDetail", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string AlarmDetail
        {
            get
            {
                return this._alarmDetail;
            }
            set
            {
                if (((_alarmDetail == value)
                            == false))
                {
                    this.OnAlarmDetailChanging(value);
                    this.SendPropertyChanging();
                    this._alarmDetail = value;
                    this.SendPropertyChanged("AlarmDetail");
                    this.OnAlarmDetailChanged();
                }
            }
        }

        [Column(Storage = "_alarmID", Name = "alarmId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmID
        {
            get
            {
                return this._alarmID;
            }
            set
            {
                if ((_alarmID != value))
                {
                    this.OnAlarmIDChanging(value);
                    this.SendPropertyChanging();
                    this._alarmID = value;
                    this.SendPropertyChanged("AlarmID");
                    this.OnAlarmIDChanged();
                }
            }
        }

        [Column(Storage = "_alarmResult", Name = "alarmResult", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string AlarmResult
        {
            get
            {
                return this._alarmResult;
            }
            set
            {
                if (((_alarmResult == value)
                            == false))
                {
                    this.OnAlarmResultChanging(value);
                    this.SendPropertyChanging();
                    this._alarmResult = value;
                    this.SendPropertyChanged("AlarmResult");
                    this.OnAlarmResultChanged();
                }
            }
        }

        [Column(Storage = "_alarmTypeID", Name = "alarmTypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmTypeID
        {
            get
            {
                return this._alarmTypeID;
            }
            set
            {
                if ((_alarmTypeID != value))
                {
                    this.OnAlarmTypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._alarmTypeID = value;
                    this.SendPropertyChanged("AlarmTypeID");
                    this.OnAlarmTypeIDChanged();
                }
            }
        }

        [Column(Storage = "_busID", Name = "busId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> BusID
        {
            get
            {
                return this._busID;
            }
            set
            {
                if ((_busID != value))
                {
                    this.OnBusIDChanging(value);
                    this.SendPropertyChanging();
                    this._busID = value;
                    this.SendPropertyChanged("BusID");
                    this.OnBusIDChanged();
                }
            }
        }

        [Column(Storage = "_cardID", Name = "cardId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> CardID
        {
            get
            {
                return this._cardID;
            }
            set
            {
                if ((_cardID != value))
                {
                    this.OnCardIDChanging(value);
                    this.SendPropertyChanging();
                    this._cardID = value;
                    this.SendPropertyChanged("CardID");
                    this.OnCardIDChanged();
                }
            }
        }

        [Column(Storage = "_endTime", Name = "endTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> EndTime
        {
            get
            {
                return this._endTime;
            }
            set
            {
                if ((_endTime != value))
                {
                    this.OnEndTimeChanging(value);
                    this.SendPropertyChanging();
                    this._endTime = value;
                    this.SendPropertyChanged("EndTime");
                    this.OnEndTimeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_isDisposed", Name = "isDisposed", DbType = "smallint(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<short> IsDisposed
        {
            get
            {
                return this._isDisposed;
            }
            set
            {
                if ((_isDisposed != value))
                {
                    this.OnIsDisposedChanging(value);
                    this.SendPropertyChanging();
                    this._isDisposed = value;
                    this.SendPropertyChanged("IsDisposed");
                    this.OnIsDisposedChanged();
                }
            }
        }

        [Column(Storage = "_localeDealDate", Name = "localeDealDate", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> LocaleDealDate
        {
            get
            {
                return this._localeDealDate;
            }
            set
            {
                if ((_localeDealDate != value))
                {
                    this.OnLocaleDealDateChanging(value);
                    this.SendPropertyChanging();
                    this._localeDealDate = value;
                    this.SendPropertyChanged("LocaleDealDate");
                    this.OnLocaleDealDateChanged();
                }
            }
        }

        [Column(Storage = "_localeDealPeople", Name = "localeDealPeople", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> LocaleDealPeople
        {
            get
            {
                return this._localeDealPeople;
            }
            set
            {
                if ((_localeDealPeople != value))
                {
                    this.OnLocaleDealPeopleChanging(value);
                    this.SendPropertyChanging();
                    this._localeDealPeople = value;
                    this.SendPropertyChanged("LocaleDealPeople");
                    this.OnLocaleDealPeopleChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        [Column(Storage = "_recordTime", Name = "recordTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> RecordTime
        {
            get
            {
                return this._recordTime;
            }
            set
            {
                if ((_recordTime != value))
                {
                    this.OnRecordTimeChanging(value);
                    this.SendPropertyChanging();
                    this._recordTime = value;
                    this.SendPropertyChanged("RecordTime");
                    this.OnRecordTimeChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_alarm_type")]
    public partial class TAlarmType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _alarmLevelID;

        private System.Nullable<int> _alarmType;

        private string _code;

        private System.Nullable<bool> _enable;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAlarmLevelIDChanged();

        partial void OnAlarmLevelIDChanging(System.Nullable<int> value);

        partial void OnAlarmTypeChanged();

        partial void OnAlarmTypeChanging(System.Nullable<int> value);

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnEnableChanged();

        partial void OnEnableChanging(System.Nullable<bool> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TAlarmType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_alarmLevelID", Name = "alarmLevelId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmLevelID
        {
            get
            {
                return this._alarmLevelID;
            }
            set
            {
                if ((_alarmLevelID != value))
                {
                    this.OnAlarmLevelIDChanging(value);
                    this.SendPropertyChanging();
                    this._alarmLevelID = value;
                    this.SendPropertyChanged("AlarmLevelID");
                    this.OnAlarmLevelIDChanged();
                }
            }
        }

        [Column(Storage = "_alarmType", Name = "alarmType", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmType
        {
            get
            {
                return this._alarmType;
            }
            set
            {
                if ((_alarmType != value))
                {
                    this.OnAlarmTypeChanging(value);
                    this.SendPropertyChanging();
                    this._alarmType = value;
                    this.SendPropertyChanged("AlarmType");
                    this.OnAlarmTypeChanged();
                }
            }
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_enable", Name = "enable", DbType = "bit(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<bool> Enable
        {
            get
            {
                return this._enable;
            }
            set
            {
                if ((_enable != value))
                {
                    this.OnEnableChanging(value);
                    this.SendPropertyChanging();
                    this._enable = value;
                    this.SendPropertyChanged("Enable");
                    this.OnEnableChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(1000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_attendants")]
    public partial class TAttendants : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _attName;

        private string _attNum;

        private System.Nullable<System.DateTime> _birthday;

        private System.Nullable<System.DateTime> _createTime;

        private string _createUser;

        private string _email;

        private int _id;

        private string _identityNum;

        private string _imagePath;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _phone;

        private string _sex;

        private string _sort;

        private System.Nullable<int> _stafftypeID;

        private string _staffTypeName;

        private System.Nullable<System.DateTime> _updateTime;

        private string _updateUser;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAttNameChanged();

        partial void OnAttNameChanging(string value);

        partial void OnAttNumChanged();

        partial void OnAttNumChanging(string value);

        partial void OnBirthdayChanged();

        partial void OnBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(string value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIdentityNumChanged();

        partial void OnIdentityNumChanging(string value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnStaffTypeNameChanged();

        partial void OnStaffTypeNameChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(string value);
        #endregion


        public TAttendants()
        {
            this.OnCreated();
        }

        [Column(Storage = "_attName", Name = "attName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string AttName
        {
            get
            {
                return this._attName;
            }
            set
            {
                if (((_attName == value)
                            == false))
                {
                    this.OnAttNameChanging(value);
                    this.SendPropertyChanging();
                    this._attName = value;
                    this.SendPropertyChanged("AttName");
                    this.OnAttNameChanged();
                }
            }
        }

        [Column(Storage = "_attNum", Name = "attNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string AttNum
        {
            get
            {
                return this._attNum;
            }
            set
            {
                if (((_attNum == value)
                            == false))
                {
                    this.OnAttNumChanging(value);
                    this.SendPropertyChanging();
                    this._attNum = value;
                    this.SendPropertyChanged("AttNum");
                    this.OnAttNumChanged();
                }
            }
        }

        [Column(Storage = "_birthday", Name = "birthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> Birthday
        {
            get
            {
                return this._birthday;
            }
            set
            {
                if ((_birthday != value))
                {
                    this.OnBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._birthday = value;
                    this.SendPropertyChanged("Birthday");
                    this.OnBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if (((_createUser == value)
                            == false))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_identityNum", Name = "identityNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string IdentityNum
        {
            get
            {
                return this._identityNum;
            }
            set
            {
                if (((_identityNum == value)
                            == false))
                {
                    this.OnIdentityNumChanging(value);
                    this.SendPropertyChanging();
                    this._identityNum = value;
                    this.SendPropertyChanged("IdentityNum");
                    this.OnIdentityNumChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_staffTypeName", Name = "staffTypeName", DbType = "varchar(30)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffTypeName
        {
            get
            {
                return this._staffTypeName;
            }
            set
            {
                if (((_staffTypeName == value)
                            == false))
                {
                    this.OnStaffTypeNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffTypeName = value;
                    this.SendPropertyChanged("StaffTypeName");
                    this.OnStaffTypeNameChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if (((_updateUser == value)
                            == false))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_attendants_card_owner")]
    public partial class TAttendantsCardOwner : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _attendantsID;

        private System.Nullable<long> _cardCode;

        private int _id;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAttendantsIDChanged();

        partial void OnAttendantsIDChanging(System.Nullable<int> value);

        partial void OnCardCodeChanged();

        partial void OnCardCodeChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);
        #endregion


        public TAttendantsCardOwner()
        {
            this.OnCreated();
        }

        [Column(Storage = "_attendantsID", Name = "attendantsId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AttendantsID
        {
            get
            {
                return this._attendantsID;
            }
            set
            {
                if ((_attendantsID != value))
                {
                    this.OnAttendantsIDChanging(value);
                    this.SendPropertyChanging();
                    this._attendantsID = value;
                    this.SendPropertyChanged("AttendantsID");
                    this.OnAttendantsIDChanged();
                }
            }
        }

        [Column(Storage = "_cardCode", Name = "cardCode", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardCode
        {
            get
            {
                return this._cardCode;
            }
            set
            {
                if ((_cardCode != value))
                {
                    this.OnCardCodeChanging(value);
                    this.SendPropertyChanging();
                    this._cardCode = value;
                    this.SendPropertyChanged("CardCode");
                    this.OnCardCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_bus")]
    public partial class TBus : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _betReUernUm;

        private string _chassisNum;

        private string _code;

        private System.Nullable<int> _colorID;

        private System.Nullable<int> _driverNum;

        private System.Nullable<int> _frontEquipmentID;

        private int _id;

        private string _imagePath;

        private string _licencePlateNum;

        private string _motorNum;

        private string _note;

        private System.Nullable<int> _num;

        private int _orgID;

        private System.Nullable<int> _passengerNum;

        private string _sort;

        private string _type;

        private System.Nullable<System.DateTime> _yearCheckTime;

        private EntitySet<TBusStaffMan> _tbUsStaffMan;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBetReUERNumChanged();

        partial void OnBetReUERNumChanging(System.Nullable<int> value);

        partial void OnChassisNumChanged();

        partial void OnChassisNumChanging(string value);

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnColorIDChanged();

        partial void OnColorIDChanging(System.Nullable<int> value);

        partial void OnDriverNumChanged();

        partial void OnDriverNumChanging(System.Nullable<int> value);

        partial void OnFrontEquipmentIDChanged();

        partial void OnFrontEquipmentIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnLicencePlateNumChanged();

        partial void OnLicencePlateNumChanging(string value);

        partial void OnMotorNumChanged();

        partial void OnMotorNumChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnNumChanged();

        partial void OnNumChanging(System.Nullable<int> value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(int value);

        partial void OnPassengerNumChanged();

        partial void OnPassengerNumChanging(System.Nullable<int> value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnTypeChanged();

        partial void OnTypeChanging(string value);

        partial void OnYearCheckTimeChanged();

        partial void OnYearCheckTimeChanging(System.Nullable<System.DateTime> value);
        #endregion


        public TBus()
        {
            _tbUsStaffMan = new EntitySet<TBusStaffMan>(new Action<TBusStaffMan>(this.TBusStaffMan_Attach), new Action<TBusStaffMan>(this.TBusStaffMan_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_betReUernUm", Name = "betreuer_num", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> BetReUERNum
        {
            get
            {
                return this._betReUernUm;
            }
            set
            {
                if ((_betReUernUm != value))
                {
                    this.OnBetReUERNumChanging(value);
                    this.SendPropertyChanging();
                    this._betReUernUm = value;
                    this.SendPropertyChanged("BetReUERNum");
                    this.OnBetReUERNumChanged();
                }
            }
        }

        [Column(Storage = "_chassisNum", Name = "chassis_num", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ChassisNum
        {
            get
            {
                return this._chassisNum;
            }
            set
            {
                if (((_chassisNum == value)
                            == false))
                {
                    this.OnChassisNumChanging(value);
                    this.SendPropertyChanging();
                    this._chassisNum = value;
                    this.SendPropertyChanged("ChassisNum");
                    this.OnChassisNumChanged();
                }
            }
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_colorID", Name = "colorId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ColorID
        {
            get
            {
                return this._colorID;
            }
            set
            {
                if ((_colorID != value))
                {
                    this.OnColorIDChanging(value);
                    this.SendPropertyChanging();
                    this._colorID = value;
                    this.SendPropertyChanged("ColorID");
                    this.OnColorIDChanged();
                }
            }
        }

        [Column(Storage = "_driverNum", Name = "driver_num", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> DriverNum
        {
            get
            {
                return this._driverNum;
            }
            set
            {
                if ((_driverNum != value))
                {
                    this.OnDriverNumChanging(value);
                    this.SendPropertyChanging();
                    this._driverNum = value;
                    this.SendPropertyChanged("DriverNum");
                    this.OnDriverNumChanged();
                }
            }
        }

        [Column(Storage = "_frontEquipmentID", Name = "frontEquipmentId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> FrontEquipmentID
        {
            get
            {
                return this._frontEquipmentID;
            }
            set
            {
                if ((_frontEquipmentID != value))
                {
                    this.OnFrontEquipmentIDChanging(value);
                    this.SendPropertyChanging();
                    this._frontEquipmentID = value;
                    this.SendPropertyChanged("FrontEquipmentID");
                    this.OnFrontEquipmentIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_licencePlateNum", Name = "licence_plate_num", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string LicencePlateNum
        {
            get
            {
                return this._licencePlateNum;
            }
            set
            {
                if (((_licencePlateNum == value)
                            == false))
                {
                    this.OnLicencePlateNumChanging(value);
                    this.SendPropertyChanging();
                    this._licencePlateNum = value;
                    this.SendPropertyChanged("LicencePlateNum");
                    this.OnLicencePlateNumChanged();
                }
            }
        }

        [Column(Storage = "_motorNum", Name = "motor_num", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string MotorNum
        {
            get
            {
                return this._motorNum;
            }
            set
            {
                if (((_motorNum == value)
                            == false))
                {
                    this.OnMotorNumChanging(value);
                    this.SendPropertyChanging();
                    this._motorNum = value;
                    this.SendPropertyChanged("MotorNum");
                    this.OnMotorNumChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_num", Name = "num", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Num
        {
            get
            {
                return this._num;
            }
            set
            {
                if ((_num != value))
                {
                    this.OnNumChanging(value);
                    this.SendPropertyChanging();
                    this._num = value;
                    this.SendPropertyChanged("Num");
                    this.OnNumChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_passengerNum", Name = "passenger_num", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> PassengerNum
        {
            get
            {
                return this._passengerNum;
            }
            set
            {
                if ((_passengerNum != value))
                {
                    this.OnPassengerNumChanging(value);
                    this.SendPropertyChanging();
                    this._passengerNum = value;
                    this.SendPropertyChanged("PassengerNum");
                    this.OnPassengerNumChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_type", Name = "type", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Type
        {
            get
            {
                return this._type;
            }
            set
            {
                if (((_type == value)
                            == false))
                {
                    this.OnTypeChanging(value);
                    this.SendPropertyChanging();
                    this._type = value;
                    this.SendPropertyChanged("Type");
                    this.OnTypeChanged();
                }
            }
        }

        [Column(Storage = "_yearCheckTime", Name = "year_check_time", DbType = "date", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> YearCheckTime
        {
            get
            {
                return this._yearCheckTime;
            }
            set
            {
                if ((_yearCheckTime != value))
                {
                    this.OnYearCheckTimeChanging(value);
                    this.SendPropertyChanging();
                    this._yearCheckTime = value;
                    this.SendPropertyChanged("YearCheckTime");
                    this.OnYearCheckTimeChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tbUsStaffMan", OtherKey = "BusID", ThisKey = "ID", Name = "FK50EB77F124C2C7F0")]
        [DebuggerNonUserCode()]
        public EntitySet<TBusStaffMan> TBusStaffMan
        {
            get
            {
                return this._tbUsStaffMan;
            }
            set
            {
                this._tbUsStaffMan = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TBusStaffMan_Attach(TBusStaffMan entity)
        {
            this.SendPropertyChanging();
            entity.TBus = this;
        }

        private void TBusStaffMan_Detach(TBusStaffMan entity)
        {
            this.SendPropertyChanging();
            entity.TBus = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_bus_staff_man")]
    public partial class TBusStaffMan : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _busID;

        private int _id;

        private System.Nullable<int> _staffID;

        private System.Nullable<int> _stafftypeID;

        private EntityRef<TBus> _tbUs = new EntityRef<TBus>();

        private EntityRef<TStaffType> _tsTaffType = new EntityRef<TStaffType>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBusIDChanged();

        partial void OnBusIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnStaffIDChanged();

        partial void OnStaffIDChanging(System.Nullable<int> value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);
        #endregion


        public TBusStaffMan()
        {
            this.OnCreated();
        }

        [Column(Storage = "_busID", Name = "busId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> BusID
        {
            get
            {
                return this._busID;
            }
            set
            {
                if ((_busID != value))
                {
                    this.OnBusIDChanging(value);
                    this.SendPropertyChanging();
                    this._busID = value;
                    this.SendPropertyChanged("BusID");
                    this.OnBusIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_staffID", Name = "staffId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StaffID
        {
            get
            {
                return this._staffID;
            }
            set
            {
                if ((_staffID != value))
                {
                    this.OnStaffIDChanging(value);
                    this.SendPropertyChanging();
                    this._staffID = value;
                    this.SendPropertyChanged("StaffID");
                    this.OnStaffIDChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_tbUs", OtherKey = "ID", ThisKey = "BusID", Name = "FK50EB77F124C2C7F0", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TBus TBus
        {
            get
            {
                return this._tbUs.Entity;
            }
            set
            {
                if (((this._tbUs.Entity == value)
                            == false))
                {
                    if ((this._tbUs.Entity != null))
                    {
                        TBus previousTBus = this._tbUs.Entity;
                        this._tbUs.Entity = null;
                        previousTBus.TBusStaffMan.Remove(this);
                    }
                    this._tbUs.Entity = value;
                    if ((value != null))
                    {
                        value.TBusStaffMan.Add(this);
                        _busID = value.ID;
                    }
                    else
                    {
                        _busID = null;
                    }
                }
            }
        }

        [Association(Storage = "_tsTaffType", OtherKey = "ID", ThisKey = "StafftypeID", Name = "FK50EB77F181D8C3F6", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TStaffType TStaffType
        {
            get
            {
                return this._tsTaffType.Entity;
            }
            set
            {
                if (((this._tsTaffType.Entity == value)
                            == false))
                {
                    if ((this._tsTaffType.Entity != null))
                    {
                        TStaffType previousTStaffType = this._tsTaffType.Entity;
                        this._tsTaffType.Entity = null;
                        previousTStaffType.TBusStaffMan.Remove(this);
                    }
                    this._tsTaffType.Entity = value;
                    if ((value != null))
                    {
                        value.TBusStaffMan.Add(this);
                        _stafftypeID = value.ID;
                    }
                    else
                    {
                        _stafftypeID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_card")]
    public partial class TCard : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _cardTypeID;

        private System.Nullable<long> _code;

        private int _count;

        private System.Nullable<System.DateTime> _createTime;

        private int _id;

        private string _note;

        private System.Nullable<int> _orgID;

        private System.Nullable<System.DateTime> _recordTime;

        private System.Nullable<int> _state;

        private EntitySet<TCardReader> _tcArdReader;

        private EntitySet<TLocateData> _tlOcateData;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardTypeIDChanged();

        partial void OnCardTypeIDChanging(System.Nullable<int> value);

        partial void OnCodeChanged();

        partial void OnCodeChanging(System.Nullable<long> value);

        partial void OnCountChanged();

        partial void OnCountChanging(int value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnRecordTimeChanged();

        partial void OnRecordTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnStateChanged();

        partial void OnStateChanging(System.Nullable<int> value);
        #endregion


        public TCard()
        {
            _tcArdReader = new EntitySet<TCardReader>(new Action<TCardReader>(this.TCardReader_Attach), new Action<TCardReader>(this.TCardReader_Detach));
            _tlOcateData = new EntitySet<TLocateData>(new Action<TLocateData>(this.TLocateData_Attach), new Action<TLocateData>(this.TLocateData_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_cardTypeID", Name = "cardTypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> CardTypeID
        {
            get
            {
                return this._cardTypeID;
            }
            set
            {
                if ((_cardTypeID != value))
                {
                    this.OnCardTypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._cardTypeID = value;
                    this.SendPropertyChanged("CardTypeID");
                    this.OnCardTypeIDChanged();
                }
            }
        }

        [Column(Storage = "_code", Name = "code", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if ((_code != value))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_count", Name = "count", DbType = "int", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int Count
        {
            get
            {
                return this._count;
            }
            set
            {
                if ((_count != value))
                {
                    this.OnCountChanging(value);
                    this.SendPropertyChanging();
                    this._count = value;
                    this.SendPropertyChanged("Count");
                    this.OnCountChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_recordTime", Name = "recordTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> RecordTime
        {
            get
            {
                return this._recordTime;
            }
            set
            {
                if ((_recordTime != value))
                {
                    this.OnRecordTimeChanging(value);
                    this.SendPropertyChanging();
                    this._recordTime = value;
                    this.SendPropertyChanged("RecordTime");
                    this.OnRecordTimeChanged();
                }
            }
        }

        [Column(Storage = "_state", Name = "state", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> State
        {
            get
            {
                return this._state;
            }
            set
            {
                if ((_state != value))
                {
                    this.OnStateChanging(value);
                    this.SendPropertyChanging();
                    this._state = value;
                    this.SendPropertyChanged("State");
                    this.OnStateChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tcArdReader", OtherKey = "CardID", ThisKey = "Code", Name = "FK16B49987FA97C7E9")]
        [DebuggerNonUserCode()]
        public EntitySet<TCardReader> TCardReader
        {
            get
            {
                return this._tcArdReader;
            }
            set
            {
                this._tcArdReader = value;
            }
        }

        [Association(Storage = "_tlOcateData", OtherKey = "CardID", ThisKey = "Code", Name = "FK19064AA7A05E9624")]
        [DebuggerNonUserCode()]
        public EntitySet<TLocateData> TLocateData
        {
            get
            {
                return this._tlOcateData;
            }
            set
            {
                this._tlOcateData = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TCardReader_Attach(TCardReader entity)
        {
            this.SendPropertyChanging();
            entity.TCard = this;
        }

        private void TCardReader_Detach(TCardReader entity)
        {
            this.SendPropertyChanging();
            entity.TCard = null;
        }

        private void TLocateData_Attach(TLocateData entity)
        {
            this.SendPropertyChanging();
            entity.TCard = this;
        }

        private void TLocateData_Detach(TLocateData entity)
        {
            this.SendPropertyChanging();
            entity.TCard = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_card_reader")]
    public partial class TCardReader : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private long _cardID;

        private long _readerID;

        private EntityRef<TReader> _trEader = new EntityRef<TReader>();

        private EntityRef<TCard> _tcArd = new EntityRef<TCard>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardIDChanged();

        partial void OnCardIDChanging(long value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(long value);
        #endregion


        public TCardReader()
        {
            this.OnCreated();
        }

        [Column(Storage = "_cardID", Name = "cardId", DbType = "bigint(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public long CardID
        {
            get
            {
                return this._cardID;
            }
            set
            {
                if ((_cardID != value))
                {
                    this.OnCardIDChanging(value);
                    this.SendPropertyChanging();
                    this._cardID = value;
                    this.SendPropertyChanged("CardID");
                    this.OnCardIDChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "bigint(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public long ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_trEader", OtherKey = "Code", ThisKey = "ReaderID", Name = "FK16B499876BEA590F", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TReader TReader
        {
            get
            {
                return this._trEader.Entity;
            }
            set
            {
                if (((this._trEader.Entity == value)
                            == false))
                {
                    if ((this._trEader.Entity != null))
                    {
                        TReader previousTReader = this._trEader.Entity;
                        this._trEader.Entity = null;
                        previousTReader.TCardReader.Remove(this);
                    }
                    this._trEader.Entity = value;
                    if ((value != null))
                    {
                        value.TCardReader.Add(this);
                        _readerID = (long)value.Code;
                    }
                    else
                    {
                        _readerID = default(long);
                    }
                }
            }
        }

        [Association(Storage = "_tcArd", OtherKey = "Code", ThisKey = "CardID", Name = "FK16B49987FA97C7E9", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TCard TCard
        {
            get
            {
                return this._tcArd.Entity;
            }
            set
            {
                if (((this._tcArd.Entity == value)
                            == false))
                {
                    if ((this._tcArd.Entity != null))
                    {
                        TCard previousTCard = this._tcArd.Entity;
                        this._tcArd.Entity = null;
                        previousTCard.TCardReader.Remove(this);
                    }
                    this._tcArd.Entity = value;
                    if ((value != null))
                    {
                        value.TCardReader.Add(this);
                        _cardID = (long)value.Code;
                    }
                    else
                    {
                        _cardID = default(long);
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_card_type")]
    public partial class TCardType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _code;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TCardType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if ((_code != value))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_driver")]
    public partial class TDriver : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _address;

        private System.Nullable<System.DateTime> _createDate;

        private System.Nullable<int> _createUserID;

        private System.Nullable<System.DateTime> _driverBirthday;

        private string _driverCardType;

        private string _driverName;

        private System.Nullable<System.DateTime> _effectiveDate;

        private string _fileNum;

        private System.Nullable<System.DateTime> _firstGetLicense;

        private int _id;

        private string _identityCard;

        private string _imagePath;

        private string _licenseNum;

        private string _nation;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _phone;

        private string _record;

        private string _sex;

        private string _sort;

        private System.Nullable<int> _stafftypeID;

        private System.Nullable<System.DateTime> _updateDate;

        private System.Nullable<int> _updateUserID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAddressChanged();

        partial void OnAddressChanging(string value);

        partial void OnCreateDateChanged();

        partial void OnCreateDateChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserIDChanged();

        partial void OnCreateUserIDChanging(System.Nullable<int> value);

        partial void OnDriverBirthdayChanged();

        partial void OnDriverBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnDriverCardTypeChanged();

        partial void OnDriverCardTypeChanging(string value);

        partial void OnDriverNameChanged();

        partial void OnDriverNameChanging(string value);

        partial void OnEffectiveDateChanged();

        partial void OnEffectiveDateChanging(System.Nullable<System.DateTime> value);

        partial void OnFileNumChanged();

        partial void OnFileNumChanging(string value);

        partial void OnFirstGetLicenseChanged();

        partial void OnFirstGetLicenseChanging(System.Nullable<System.DateTime> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIdentityCardChanged();

        partial void OnIdentityCardChanging(string value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnLicenseNumChanged();

        partial void OnLicenseNumChanging(string value);

        partial void OnNationChanged();

        partial void OnNationChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnRecordChanged();

        partial void OnRecordChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnUpdateDateChanged();

        partial void OnUpdateDateChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserIDChanged();

        partial void OnUpdateUserIDChanging(System.Nullable<int> value);
        #endregion


        public TDriver()
        {
            this.OnCreated();
        }

        [Column(Storage = "_address", Name = "address", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Address
        {
            get
            {
                return this._address;
            }
            set
            {
                if (((_address == value)
                            == false))
                {
                    this.OnAddressChanging(value);
                    this.SendPropertyChanging();
                    this._address = value;
                    this.SendPropertyChanged("Address");
                    this.OnAddressChanged();
                }
            }
        }

        [Column(Storage = "_createDate", Name = "createDate", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateDate
        {
            get
            {
                return this._createDate;
            }
            set
            {
                if ((_createDate != value))
                {
                    this.OnCreateDateChanging(value);
                    this.SendPropertyChanging();
                    this._createDate = value;
                    this.SendPropertyChanged("CreateDate");
                    this.OnCreateDateChanged();
                }
            }
        }

        [Column(Storage = "_createUserID", Name = "createUserId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> CreateUserID
        {
            get
            {
                return this._createUserID;
            }
            set
            {
                if ((_createUserID != value))
                {
                    this.OnCreateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._createUserID = value;
                    this.SendPropertyChanged("CreateUserID");
                    this.OnCreateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_driverBirthday", Name = "driverBirthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> DriverBirthday
        {
            get
            {
                return this._driverBirthday;
            }
            set
            {
                if ((_driverBirthday != value))
                {
                    this.OnDriverBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._driverBirthday = value;
                    this.SendPropertyChanged("DriverBirthday");
                    this.OnDriverBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_driverCardType", Name = "driverCardType", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string DriverCardType
        {
            get
            {
                return this._driverCardType;
            }
            set
            {
                if (((_driverCardType == value)
                            == false))
                {
                    this.OnDriverCardTypeChanging(value);
                    this.SendPropertyChanging();
                    this._driverCardType = value;
                    this.SendPropertyChanged("DriverCardType");
                    this.OnDriverCardTypeChanged();
                }
            }
        }

        [Column(Storage = "_driverName", Name = "driverName", DbType = "varchar(10)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string DriverName
        {
            get
            {
                return this._driverName;
            }
            set
            {
                if (((_driverName == value)
                            == false))
                {
                    this.OnDriverNameChanging(value);
                    this.SendPropertyChanging();
                    this._driverName = value;
                    this.SendPropertyChanged("DriverName");
                    this.OnDriverNameChanged();
                }
            }
        }

        [Column(Storage = "_effectiveDate", Name = "effectiveDate", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> EffectiveDate
        {
            get
            {
                return this._effectiveDate;
            }
            set
            {
                if ((_effectiveDate != value))
                {
                    this.OnEffectiveDateChanging(value);
                    this.SendPropertyChanging();
                    this._effectiveDate = value;
                    this.SendPropertyChanged("EffectiveDate");
                    this.OnEffectiveDateChanged();
                }
            }
        }

        [Column(Storage = "_fileNum", Name = "fileNum", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string FileNum
        {
            get
            {
                return this._fileNum;
            }
            set
            {
                if (((_fileNum == value)
                            == false))
                {
                    this.OnFileNumChanging(value);
                    this.SendPropertyChanging();
                    this._fileNum = value;
                    this.SendPropertyChanged("FileNum");
                    this.OnFileNumChanged();
                }
            }
        }

        [Column(Storage = "_firstGetLicense", Name = "firstGetLicense", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> FirstGetLicense
        {
            get
            {
                return this._firstGetLicense;
            }
            set
            {
                if ((_firstGetLicense != value))
                {
                    this.OnFirstGetLicenseChanging(value);
                    this.SendPropertyChanging();
                    this._firstGetLicense = value;
                    this.SendPropertyChanged("FirstGetLicense");
                    this.OnFirstGetLicenseChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_identityCard", Name = "identityCard", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string IdentityCard
        {
            get
            {
                return this._identityCard;
            }
            set
            {
                if (((_identityCard == value)
                            == false))
                {
                    this.OnIdentityCardChanging(value);
                    this.SendPropertyChanging();
                    this._identityCard = value;
                    this.SendPropertyChanged("IdentityCard");
                    this.OnIdentityCardChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_licenseNum", Name = "licenseNum", DbType = "varchar(18)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string LicenseNum
        {
            get
            {
                return this._licenseNum;
            }
            set
            {
                if (((_licenseNum == value)
                            == false))
                {
                    this.OnLicenseNumChanging(value);
                    this.SendPropertyChanging();
                    this._licenseNum = value;
                    this.SendPropertyChanged("LicenseNum");
                    this.OnLicenseNumChanged();
                }
            }
        }

        [Column(Storage = "_nation", Name = "nation", DbType = "varchar(10)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Nation
        {
            get
            {
                return this._nation;
            }
            set
            {
                if (((_nation == value)
                            == false))
                {
                    this.OnNationChanging(value);
                    this.SendPropertyChanging();
                    this._nation = value;
                    this.SendPropertyChanged("Nation");
                    this.OnNationChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(15)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_record", Name = "record", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Record
        {
            get
            {
                return this._record;
            }
            set
            {
                if (((_record == value)
                            == false))
                {
                    this.OnRecordChanging(value);
                    this.SendPropertyChanging();
                    this._record = value;
                    this.SendPropertyChanged("Record");
                    this.OnRecordChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(2)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_updateDate", Name = "updateDate", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateDate
        {
            get
            {
                return this._updateDate;
            }
            set
            {
                if ((_updateDate != value))
                {
                    this.OnUpdateDateChanging(value);
                    this.SendPropertyChanging();
                    this._updateDate = value;
                    this.SendPropertyChanged("UpdateDate");
                    this.OnUpdateDateChanged();
                }
            }
        }

        [Column(Storage = "_updateUserID", Name = "updateUserId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> UpdateUserID
        {
            get
            {
                return this._updateUserID;
            }
            set
            {
                if ((_updateUserID != value))
                {
                    this.OnUpdateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._updateUserID = value;
                    this.SendPropertyChanged("UpdateUserID");
                    this.OnUpdateUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [Table(Name = "schoolbus.t_driver_card_owner")]
    public partial class TDriverCardOwner : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<long> _cardCode;

        private System.Nullable<int> _driverID;

        private int _id;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardCodeChanged();

        partial void OnCardCodeChanging(System.Nullable<long> value);

        partial void OnDriverIDChanged();

        partial void OnDriverIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);
        #endregion


        public TDriverCardOwner()
        {
            this.OnCreated();
        }

        [Column(Storage = "_cardCode", Name = "cardCode", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardCode
        {
            get
            {
                return this._cardCode;
            }
            set
            {
                if ((_cardCode != value))
                {
                    this.OnCardCodeChanging(value);
                    this.SendPropertyChanging();
                    this._cardCode = value;
                    this.SendPropertyChanged("CardCode");
                    this.OnCardCodeChanged();
                }
            }
        }

        [Column(Storage = "_driverID", Name = "driverId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> DriverID
        {
            get
            {
                return this._driverID;
            }
            set
            {
                if ((_driverID != value))
                {
                    this.OnDriverIDChanging(value);
                    this.SendPropertyChanging();
                    this._driverID = value;
                    this.SendPropertyChanged("DriverID");
                    this.OnDriverIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_driver_card_type")]
    public partial class TDriverCardType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private System.Nullable<int> _enable;

        private long _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnEnableChanged();

        partial void OnEnableChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(long value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TDriverCardType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_enable", Name = "enable", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Enable
        {
            get
            {
                return this._enable;
            }
            set
            {
                if ((_enable != value))
                {
                    this.OnEnableChanging(value);
                    this.SendPropertyChanging();
                    this._enable = value;
                    this.SendPropertyChanged("Enable");
                    this.OnEnableChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "bigint(20)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public long ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_frontequipment")]
    public partial class TFrontEquipment : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private string _gpsEquiCode;

        private int _id;

        private string _note;

        private System.Nullable<int> _orgID;

        private System.Nullable<int> _readerID;

        private string _videoEquiCode;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnGpsEquiCodeChanged();

        partial void OnGpsEquiCodeChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(System.Nullable<int> value);

        partial void OnVideoEquiCodeChanged();

        partial void OnVideoEquiCodeChanging(string value);
        #endregion


        public TFrontEquipment()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_gpsEquiCode", Name = "gpsEquiCode", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string GpsEquiCode
        {
            get
            {
                return this._gpsEquiCode;
            }
            set
            {
                if (((_gpsEquiCode == value)
                            == false))
                {
                    this.OnGpsEquiCodeChanging(value);
                    this.SendPropertyChanging();
                    this._gpsEquiCode = value;
                    this.SendPropertyChanged("GpsEquiCode");
                    this.OnGpsEquiCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        [Column(Storage = "_videoEquiCode", Name = "videoEquiCode", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string VideoEquiCode
        {
            get
            {
                return this._videoEquiCode;
            }
            set
            {
                if (((_videoEquiCode == value)
                            == false))
                {
                    this.OnVideoEquiCodeChanging(value);
                    this.SendPropertyChanging();
                    this._videoEquiCode = value;
                    this.SendPropertyChanged("VideoEquiCode");
                    this.OnVideoEquiCodeChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_functioninfo")]
    public partial class TFunctionInfo : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _funName;

        private int _id;

        private string _menuName;

        private string _note1;

        private string _note2;

        private string _note3;

        private string _note4;

        private string _note5;

        private System.Nullable<int> _parentFunID;

        private System.Nullable<short> _sortValue;

        private EntitySet<TResource> _trEsource;

        private EntitySet<TFunctionInfo> _idtfUnctionInfo;

        private EntityRef<TFunctionInfo> _parentFunIdtfUnctionInfo = new EntityRef<TFunctionInfo>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnFunNameChanged();

        partial void OnFunNameChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnMenuNameChanged();

        partial void OnMenuNameChanging(string value);

        partial void OnNote1Changed();

        partial void OnNote1Changing(string value);

        partial void OnNote2Changed();

        partial void OnNote2Changing(string value);

        partial void OnNote3Changed();

        partial void OnNote3Changing(string value);

        partial void OnNote4Changed();

        partial void OnNote4Changing(string value);

        partial void OnNote5Changed();

        partial void OnNote5Changing(string value);

        partial void OnParentFunIDChanged();

        partial void OnParentFunIDChanging(System.Nullable<int> value);

        partial void OnSortValueChanged();

        partial void OnSortValueChanging(System.Nullable<short> value);
        #endregion


        public TFunctionInfo()
        {
            _trEsource = new EntitySet<TResource>(new Action<TResource>(this.TResource_Attach), new Action<TResource>(this.TResource_Detach));
            _idtfUnctionInfo = new EntitySet<TFunctionInfo>(new Action<TFunctionInfo>(this.IDTFunctionInfo_Attach), new Action<TFunctionInfo>(this.IDTFunctionInfo_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_funName", Name = "funName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string FunName
        {
            get
            {
                return this._funName;
            }
            set
            {
                if (((_funName == value)
                            == false))
                {
                    this.OnFunNameChanging(value);
                    this.SendPropertyChanging();
                    this._funName = value;
                    this.SendPropertyChanged("FunName");
                    this.OnFunNameChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_menuName", Name = "menuName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string MenuName
        {
            get
            {
                return this._menuName;
            }
            set
            {
                if (((_menuName == value)
                            == false))
                {
                    this.OnMenuNameChanging(value);
                    this.SendPropertyChanging();
                    this._menuName = value;
                    this.SendPropertyChanged("MenuName");
                    this.OnMenuNameChanged();
                }
            }
        }

        [Column(Storage = "_note1", Name = "note1", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note1
        {
            get
            {
                return this._note1;
            }
            set
            {
                if (((_note1 == value)
                            == false))
                {
                    this.OnNote1Changing(value);
                    this.SendPropertyChanging();
                    this._note1 = value;
                    this.SendPropertyChanged("Note1");
                    this.OnNote1Changed();
                }
            }
        }

        [Column(Storage = "_note2", Name = "note2", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note2
        {
            get
            {
                return this._note2;
            }
            set
            {
                if (((_note2 == value)
                            == false))
                {
                    this.OnNote2Changing(value);
                    this.SendPropertyChanging();
                    this._note2 = value;
                    this.SendPropertyChanged("Note2");
                    this.OnNote2Changed();
                }
            }
        }

        [Column(Storage = "_note3", Name = "note3", DbType = "varchar(500)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note3
        {
            get
            {
                return this._note3;
            }
            set
            {
                if (((_note3 == value)
                            == false))
                {
                    this.OnNote3Changing(value);
                    this.SendPropertyChanging();
                    this._note3 = value;
                    this.SendPropertyChanged("Note3");
                    this.OnNote3Changed();
                }
            }
        }

        [Column(Storage = "_note4", Name = "note4", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note4
        {
            get
            {
                return this._note4;
            }
            set
            {
                if (((_note4 == value)
                            == false))
                {
                    this.OnNote4Changing(value);
                    this.SendPropertyChanging();
                    this._note4 = value;
                    this.SendPropertyChanged("Note4");
                    this.OnNote4Changed();
                }
            }
        }

        [Column(Storage = "_note5", Name = "note5", DbType = "varchar(200)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note5
        {
            get
            {
                return this._note5;
            }
            set
            {
                if (((_note5 == value)
                            == false))
                {
                    this.OnNote5Changing(value);
                    this.SendPropertyChanging();
                    this._note5 = value;
                    this.SendPropertyChanged("Note5");
                    this.OnNote5Changed();
                }
            }
        }

        [Column(Storage = "_parentFunID", Name = "parentFunId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentFunID
        {
            get
            {
                return this._parentFunID;
            }
            set
            {
                if ((_parentFunID != value))
                {
                    this.OnParentFunIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentFunID = value;
                    this.SendPropertyChanged("ParentFunID");
                    this.OnParentFunIDChanged();
                }
            }
        }

        [Column(Storage = "_sortValue", Name = "sortValue", DbType = "smallint(6)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<short> SortValue
        {
            get
            {
                return this._sortValue;
            }
            set
            {
                if ((_sortValue != value))
                {
                    this.OnSortValueChanging(value);
                    this.SendPropertyChanging();
                    this._sortValue = value;
                    this.SendPropertyChanged("SortValue");
                    this.OnSortValueChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_trEsource", OtherKey = "FunctionID", ThisKey = "ID", Name = "FKA2583779C2F55798")]
        [DebuggerNonUserCode()]
        public EntitySet<TResource> TResource
        {
            get
            {
                return this._trEsource;
            }
            set
            {
                this._trEsource = value;
            }
        }

        [Association(Storage = "_idtfUnctionInfo", OtherKey = "ParentFunID", ThisKey = "ID", Name = "FKCE91F2713997515")]
        [DebuggerNonUserCode()]
        public EntitySet<TFunctionInfo> IDTFunctionInfo
        {
            get
            {
                return this._idtfUnctionInfo;
            }
            set
            {
                this._idtfUnctionInfo = value;
            }
        }
        #endregion

        #region Parents
        [Association(Storage = "_parentFunIdtfUnctionInfo", OtherKey = "ID", ThisKey = "ParentFunID", Name = "FKCE91F2713997515", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TFunctionInfo ParentFunIDTFunctionInfo
        {
            get
            {
                return this._parentFunIdtfUnctionInfo.Entity;
            }
            set
            {
                if (((this._parentFunIdtfUnctionInfo.Entity == value)
                            == false))
                {
                    if ((this._parentFunIdtfUnctionInfo.Entity != null))
                    {
                        TFunctionInfo previousTFunctionInfo = this._parentFunIdtfUnctionInfo.Entity;
                        this._parentFunIdtfUnctionInfo.Entity = null;
                        previousTFunctionInfo.IDTFunctionInfo.Remove(this);
                    }
                    this._parentFunIdtfUnctionInfo.Entity = value;
                    if ((value != null))
                    {
                        value.IDTFunctionInfo.Add(this);
                        _parentFunID = value.ID;
                    }
                    else
                    {
                        _parentFunID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TResource_Attach(TResource entity)
        {
            this.SendPropertyChanging();
            entity.TFunctionInfo = this;
        }

        private void TResource_Detach(TResource entity)
        {
            this.SendPropertyChanging();
            entity.TFunctionInfo = null;
        }

        private void IDTFunctionInfo_Attach(TFunctionInfo entity)
        {
            this.SendPropertyChanging();
            entity.ParentFunIDTFunctionInfo = this;
        }

        private void IDTFunctionInfo_Detach(TFunctionInfo entity)
        {
            this.SendPropertyChanging();
            entity.ParentFunIDTFunctionInfo = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_given_class")]
    public partial class TGivenClass : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _id;

        private System.Nullable<int> _orgID;

        private System.Nullable<int> _teacherID;

        private EntityRef<TTeacher> _ttEacher = new EntityRef<TTeacher>();

        private EntityRef<TOrganization> _toRganization = new EntityRef<TOrganization>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnTeacherIDChanged();

        partial void OnTeacherIDChanging(System.Nullable<int> value);
        #endregion


        public TGivenClass()
        {
            this.OnCreated();
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_teacherID", Name = "teacherId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> TeacherID
        {
            get
            {
                return this._teacherID;
            }
            set
            {
                if ((_teacherID != value))
                {
                    this.OnTeacherIDChanging(value);
                    this.SendPropertyChanging();
                    this._teacherID = value;
                    this.SendPropertyChanged("TeacherID");
                    this.OnTeacherIDChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_ttEacher", OtherKey = "ID", ThisKey = "TeacherID", Name = "FKBE8002EB245C591A", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TTeacher TTeacher
        {
            get
            {
                return this._ttEacher.Entity;
            }
            set
            {
                if (((this._ttEacher.Entity == value)
                            == false))
                {
                    if ((this._ttEacher.Entity != null))
                    {
                        TTeacher previousTTeacher = this._ttEacher.Entity;
                        this._ttEacher.Entity = null;
                        previousTTeacher.TGivenClass.Remove(this);
                    }
                    this._ttEacher.Entity = value;
                    if ((value != null))
                    {
                        value.TGivenClass.Add(this);
                        _teacherID = value.ID;
                    }
                    else
                    {
                        _teacherID = null;
                    }
                }
            }
        }

        [Association(Storage = "_toRganization", OtherKey = "ID", ThisKey = "OrgID", Name = "FKBE8002EB4A6B1857", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TOrganization TOrganization
        {
            get
            {
                return this._toRganization.Entity;
            }
            set
            {
                if (((this._toRganization.Entity == value)
                            == false))
                {
                    if ((this._toRganization.Entity != null))
                    {
                        TOrganization previousTOrganization = this._toRganization.Entity;
                        this._toRganization.Entity = null;
                        previousTOrganization.TGivenClass.Remove(this);
                    }
                    this._toRganization.Entity = value;
                    if ((value != null))
                    {
                        value.TGivenClass.Add(this);
                        _orgID = value.ID;
                    }
                    else
                    {
                        _orgID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_locatedata")]
    public partial class TLocateData : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _alarmState;

        private System.Nullable<long> _cardID;

        private System.Nullable<long> _readerID;

        private System.Nullable<long> _readerIddX;

        private int _recordID;

        private System.Nullable<int> _signIntensity;

        private System.Nullable<int> _signIntensityDx;

        private System.Nullable<System.DateTime> _startTime;

        private System.Nullable<System.DateTime> _startTimeDx;

        private System.Nullable<int> _x;

        private System.Nullable<int> _y;

        private System.Nullable<int> _z;

        private EntityRef<TReader> _trEader = new EntityRef<TReader>();

        private EntityRef<TCard> _tcArd = new EntityRef<TCard>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAlarmStateChanged();

        partial void OnAlarmStateChanging(System.Nullable<int> value);

        partial void OnCardIDChanged();

        partial void OnCardIDChanging(System.Nullable<long> value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(System.Nullable<long> value);

        partial void OnReaderIDDxChanged();

        partial void OnReaderIDDxChanging(System.Nullable<long> value);

        partial void OnRecordIDChanged();

        partial void OnRecordIDChanging(int value);

        partial void OnSignIntensityChanged();

        partial void OnSignIntensityChanging(System.Nullable<int> value);

        partial void OnSignIntensityDxChanged();

        partial void OnSignIntensityDxChanging(System.Nullable<int> value);

        partial void OnStartTimeChanged();

        partial void OnStartTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnStartTimeDxChanged();

        partial void OnStartTimeDxChanging(System.Nullable<System.DateTime> value);

        partial void OnXChanged();

        partial void OnXChanging(System.Nullable<int> value);

        partial void OnYChanged();

        partial void OnYChanging(System.Nullable<int> value);

        partial void OnZChanged();

        partial void OnZChanging(System.Nullable<int> value);
        #endregion


        public TLocateData()
        {
            this.OnCreated();
        }

        [Column(Storage = "_alarmState", Name = "alarmState", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmState
        {
            get
            {
                return this._alarmState;
            }
            set
            {
                if ((_alarmState != value))
                {
                    this.OnAlarmStateChanging(value);
                    this.SendPropertyChanging();
                    this._alarmState = value;
                    this.SendPropertyChanged("AlarmState");
                    this.OnAlarmStateChanged();
                }
            }
        }

        [Column(Storage = "_cardID", Name = "cardId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardID
        {
            get
            {
                return this._cardID;
            }
            set
            {
                if ((_cardID != value))
                {
                    this.OnCardIDChanging(value);
                    this.SendPropertyChanging();
                    this._cardID = value;
                    this.SendPropertyChanged("CardID");
                    this.OnCardIDChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        [Column(Storage = "_readerIddX", Name = "readerIdDx", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> ReaderIDDx
        {
            get
            {
                return this._readerIddX;
            }
            set
            {
                if ((_readerIddX != value))
                {
                    this.OnReaderIDDxChanging(value);
                    this.SendPropertyChanging();
                    this._readerIddX = value;
                    this.SendPropertyChanged("ReaderIDDx");
                    this.OnReaderIDDxChanged();
                }
            }
        }

        [Column(Storage = "_recordID", Name = "recordId", DbType = "int(20)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RecordID
        {
            get
            {
                return this._recordID;
            }
            set
            {
                if ((_recordID != value))
                {
                    this.OnRecordIDChanging(value);
                    this.SendPropertyChanging();
                    this._recordID = value;
                    this.SendPropertyChanged("RecordID");
                    this.OnRecordIDChanged();
                }
            }
        }

        [Column(Storage = "_signIntensity", Name = "signIntensity", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> SignIntensity
        {
            get
            {
                return this._signIntensity;
            }
            set
            {
                if ((_signIntensity != value))
                {
                    this.OnSignIntensityChanging(value);
                    this.SendPropertyChanging();
                    this._signIntensity = value;
                    this.SendPropertyChanged("SignIntensity");
                    this.OnSignIntensityChanged();
                }
            }
        }

        [Column(Storage = "_signIntensityDx", Name = "signIntensityDx", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> SignIntensityDx
        {
            get
            {
                return this._signIntensityDx;
            }
            set
            {
                if ((_signIntensityDx != value))
                {
                    this.OnSignIntensityDxChanging(value);
                    this.SendPropertyChanging();
                    this._signIntensityDx = value;
                    this.SendPropertyChanged("SignIntensityDx");
                    this.OnSignIntensityDxChanged();
                }
            }
        }

        [Column(Storage = "_startTime", Name = "startTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> StartTime
        {
            get
            {
                return this._startTime;
            }
            set
            {
                if ((_startTime != value))
                {
                    this.OnStartTimeChanging(value);
                    this.SendPropertyChanging();
                    this._startTime = value;
                    this.SendPropertyChanged("StartTime");
                    this.OnStartTimeChanged();
                }
            }
        }

        [Column(Storage = "_startTimeDx", Name = "startTimeDx", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> StartTimeDx
        {
            get
            {
                return this._startTimeDx;
            }
            set
            {
                if ((_startTimeDx != value))
                {
                    this.OnStartTimeDxChanging(value);
                    this.SendPropertyChanging();
                    this._startTimeDx = value;
                    this.SendPropertyChanged("StartTimeDx");
                    this.OnStartTimeDxChanged();
                }
            }
        }

        [Column(Storage = "_x", Name = "x", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> X
        {
            get
            {
                return this._x;
            }
            set
            {
                if ((_x != value))
                {
                    this.OnXChanging(value);
                    this.SendPropertyChanging();
                    this._x = value;
                    this.SendPropertyChanged("X");
                    this.OnXChanged();
                }
            }
        }

        [Column(Storage = "_y", Name = "y", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Y
        {
            get
            {
                return this._y;
            }
            set
            {
                if ((_y != value))
                {
                    this.OnYChanging(value);
                    this.SendPropertyChanging();
                    this._y = value;
                    this.SendPropertyChanged("Y");
                    this.OnYChanged();
                }
            }
        }

        [Column(Storage = "_z", Name = "z", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Z
        {
            get
            {
                return this._z;
            }
            set
            {
                if ((_z != value))
                {
                    this.OnZChanging(value);
                    this.SendPropertyChanging();
                    this._z = value;
                    this.SendPropertyChanged("Z");
                    this.OnZChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_trEader", OtherKey = "Code", ThisKey = "ReaderID", Name = "FK19064AA76BEA590F", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TReader TReader
        {
            get
            {
                return this._trEader.Entity;
            }
            set
            {
                if (((this._trEader.Entity == value)
                            == false))
                {
                    if ((this._trEader.Entity != null))
                    {
                        TReader previousTReader = this._trEader.Entity;
                        this._trEader.Entity = null;
                        previousTReader.TLocateData.Remove(this);
                    }
                    this._trEader.Entity = value;
                    if ((value != null))
                    {
                        value.TLocateData.Add(this);
                        _readerID = value.Code;
                    }
                    else
                    {
                        _readerID = null;
                    }
                }
            }
        }

        [Association(Storage = "_tcArd", OtherKey = "Code", ThisKey = "CardID", Name = "FK19064AA7A05E9624", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TCard TCard
        {
            get
            {
                return this._tcArd.Entity;
            }
            set
            {
                if (((this._tcArd.Entity == value)
                            == false))
                {
                    if ((this._tcArd.Entity != null))
                    {
                        TCard previousTCard = this._tcArd.Entity;
                        this._tcArd.Entity = null;
                        previousTCard.TLocateData.Remove(this);
                    }
                    this._tcArd.Entity = value;
                    if ((value != null))
                    {
                        value.TLocateData.Add(this);
                        _cardID = value.Code;
                    }
                    else
                    {
                        _cardID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_log")]
    public partial class TLog : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.DateTime _logDate;

        private string _logDetail;

        private string _logType;

        private int _recordID;

        private string _userAction;

        private string _userID;

        private string _useRip;

        private EntityRef<TUser> _tuSer = new EntityRef<TUser>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnLogDateChanged();

        partial void OnLogDateChanging(System.DateTime value);

        partial void OnLogDetailChanged();

        partial void OnLogDetailChanging(string value);

        partial void OnLogTypeChanged();

        partial void OnLogTypeChanging(string value);

        partial void OnRecordIDChanged();

        partial void OnRecordIDChanging(int value);

        partial void OnUserActionChanged();

        partial void OnUserActionChanging(string value);

        partial void OnUserIDChanged();

        partial void OnUserIDChanging(string value);

        partial void OnUseRipChanged();

        partial void OnUseRipChanging(string value);
        #endregion


        public TLog()
        {
            this.OnCreated();
        }

        [Column(Storage = "_logDate", Name = "logdate", DbType = "datetime", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public System.DateTime LogDate
        {
            get
            {
                return this._logDate;
            }
            set
            {
                if ((_logDate != value))
                {
                    this.OnLogDateChanging(value);
                    this.SendPropertyChanging();
                    this._logDate = value;
                    this.SendPropertyChanged("LogDate");
                    this.OnLogDateChanged();
                }
            }
        }

        [Column(Storage = "_logDetail", Name = "logdetail", DbType = "varchar(3000)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string LogDetail
        {
            get
            {
                return this._logDetail;
            }
            set
            {
                if (((_logDetail == value)
                            == false))
                {
                    this.OnLogDetailChanging(value);
                    this.SendPropertyChanging();
                    this._logDetail = value;
                    this.SendPropertyChanged("LogDetail");
                    this.OnLogDetailChanged();
                }
            }
        }

        [Column(Storage = "_logType", Name = "logtype", DbType = "char(1)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string LogType
        {
            get
            {
                return this._logType;
            }
            set
            {
                if (((_logType == value)
                            == false))
                {
                    this.OnLogTypeChanging(value);
                    this.SendPropertyChanging();
                    this._logType = value;
                    this.SendPropertyChanged("LogType");
                    this.OnLogTypeChanged();
                }
            }
        }

        [Column(Storage = "_recordID", Name = "recordid", DbType = "int(20)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RecordID
        {
            get
            {
                return this._recordID;
            }
            set
            {
                if ((_recordID != value))
                {
                    this.OnRecordIDChanging(value);
                    this.SendPropertyChanging();
                    this._recordID = value;
                    this.SendPropertyChanged("RecordID");
                    this.OnRecordIDChanged();
                }
            }
        }

        [Column(Storage = "_userAction", Name = "useraction", DbType = "varchar(200)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string UserAction
        {
            get
            {
                return this._userAction;
            }
            set
            {
                if (((_userAction == value)
                            == false))
                {
                    this.OnUserActionChanging(value);
                    this.SendPropertyChanging();
                    this._userAction = value;
                    this.SendPropertyChanged("UserAction");
                    this.OnUserActionChanged();
                }
            }
        }

        [Column(Storage = "_userID", Name = "userid", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string UserID
        {
            get
            {
                return this._userID;
            }
            set
            {
                if (((_userID == value)
                            == false))
                {
                    this.OnUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._userID = value;
                    this.SendPropertyChanged("UserID");
                    this.OnUserIDChanged();
                }
            }
        }

        [Column(Storage = "_useRip", Name = "userip", DbType = "varchar(16)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string UseRip
        {
            get
            {
                return this._useRip;
            }
            set
            {
                if (((_useRip == value)
                            == false))
                {
                    this.OnUseRipChanging(value);
                    this.SendPropertyChanging();
                    this._useRip = value;
                    this.SendPropertyChanged("UseRip");
                    this.OnUseRipChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_tuSer", OtherKey = "LoginName", ThisKey = "UserID", Name = "FKCFF9B92758D78B32", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TUser TUser
        {
            get
            {
                return this._tuSer.Entity;
            }
            set
            {
                if (((this._tuSer.Entity == value)
                            == false))
                {
                    if ((this._tuSer.Entity != null))
                    {
                        TUser previousTUser = this._tuSer.Entity;
                        this._tuSer.Entity = null;
                        previousTUser.TLog.Remove(this);
                    }
                    this._tuSer.Entity = value;
                    if ((value != null))
                    {
                        value.TLog.Add(this);
                        _userID = value.LoginName;
                    }
                    else
                    {
                        _userID = default(string);
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_monitortype")]
    public partial class TMonitorType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<short> _area;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAreaChanged();

        partial void OnAreaChanging(System.Nullable<short> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TMonitorType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_area", Name = "area", DbType = "smallint(6)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<short> Area
        {
            get
            {
                return this._area;
            }
            set
            {
                if ((_area != value))
                {
                    this.OnAreaChanging(value);
                    this.SendPropertyChanging();
                    this._area = value;
                    this.SendPropertyChanged("Area");
                    this.OnAreaChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_oldlocatedata")]
    public partial class TOldLocateData : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _alarmState;

        private System.Nullable<long> _cardID;

        private System.Nullable<long> _readerID;

        private System.Nullable<long> _readerIddX;

        private int _recordID;

        private System.Nullable<int> _signIntensity;

        private System.Nullable<int> _signIntensityDx;

        private System.Nullable<System.DateTime> _startTime;

        private System.Nullable<System.DateTime> _startTimeDx;

        private System.Nullable<int> _x;

        private System.Nullable<int> _y;

        private System.Nullable<int> _z;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnAlarmStateChanged();

        partial void OnAlarmStateChanging(System.Nullable<int> value);

        partial void OnCardIDChanged();

        partial void OnCardIDChanging(System.Nullable<long> value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(System.Nullable<long> value);

        partial void OnReaderIDDxChanged();

        partial void OnReaderIDDxChanging(System.Nullable<long> value);

        partial void OnRecordIDChanged();

        partial void OnRecordIDChanging(int value);

        partial void OnSignIntensityChanged();

        partial void OnSignIntensityChanging(System.Nullable<int> value);

        partial void OnSignIntensityDxChanged();

        partial void OnSignIntensityDxChanging(System.Nullable<int> value);

        partial void OnStartTimeChanged();

        partial void OnStartTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnStartTimeDxChanged();

        partial void OnStartTimeDxChanging(System.Nullable<System.DateTime> value);

        partial void OnXChanged();

        partial void OnXChanging(System.Nullable<int> value);

        partial void OnYChanged();

        partial void OnYChanging(System.Nullable<int> value);

        partial void OnZChanged();

        partial void OnZChanging(System.Nullable<int> value);
        #endregion


        public TOldLocateData()
        {
            this.OnCreated();
        }

        [Column(Storage = "_alarmState", Name = "alarmState", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> AlarmState
        {
            get
            {
                return this._alarmState;
            }
            set
            {
                if ((_alarmState != value))
                {
                    this.OnAlarmStateChanging(value);
                    this.SendPropertyChanging();
                    this._alarmState = value;
                    this.SendPropertyChanged("AlarmState");
                    this.OnAlarmStateChanged();
                }
            }
        }

        [Column(Storage = "_cardID", Name = "cardId", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardID
        {
            get
            {
                return this._cardID;
            }
            set
            {
                if ((_cardID != value))
                {
                    this.OnCardIDChanging(value);
                    this.SendPropertyChanging();
                    this._cardID = value;
                    this.SendPropertyChanged("CardID");
                    this.OnCardIDChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        [Column(Storage = "_readerIddX", Name = "readerIdDx", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> ReaderIDDx
        {
            get
            {
                return this._readerIddX;
            }
            set
            {
                if ((_readerIddX != value))
                {
                    this.OnReaderIDDxChanging(value);
                    this.SendPropertyChanging();
                    this._readerIddX = value;
                    this.SendPropertyChanged("ReaderIDDx");
                    this.OnReaderIDDxChanged();
                }
            }
        }

        [Column(Storage = "_recordID", Name = "recordId", DbType = "int(20)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RecordID
        {
            get
            {
                return this._recordID;
            }
            set
            {
                if ((_recordID != value))
                {
                    this.OnRecordIDChanging(value);
                    this.SendPropertyChanging();
                    this._recordID = value;
                    this.SendPropertyChanged("RecordID");
                    this.OnRecordIDChanged();
                }
            }
        }

        [Column(Storage = "_signIntensity", Name = "signIntensity", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> SignIntensity
        {
            get
            {
                return this._signIntensity;
            }
            set
            {
                if ((_signIntensity != value))
                {
                    this.OnSignIntensityChanging(value);
                    this.SendPropertyChanging();
                    this._signIntensity = value;
                    this.SendPropertyChanged("SignIntensity");
                    this.OnSignIntensityChanged();
                }
            }
        }

        [Column(Storage = "_signIntensityDx", Name = "signIntensityDx", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> SignIntensityDx
        {
            get
            {
                return this._signIntensityDx;
            }
            set
            {
                if ((_signIntensityDx != value))
                {
                    this.OnSignIntensityDxChanging(value);
                    this.SendPropertyChanging();
                    this._signIntensityDx = value;
                    this.SendPropertyChanged("SignIntensityDx");
                    this.OnSignIntensityDxChanged();
                }
            }
        }

        [Column(Storage = "_startTime", Name = "startTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> StartTime
        {
            get
            {
                return this._startTime;
            }
            set
            {
                if ((_startTime != value))
                {
                    this.OnStartTimeChanging(value);
                    this.SendPropertyChanging();
                    this._startTime = value;
                    this.SendPropertyChanged("StartTime");
                    this.OnStartTimeChanged();
                }
            }
        }

        [Column(Storage = "_startTimeDx", Name = "startTimeDx", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> StartTimeDx
        {
            get
            {
                return this._startTimeDx;
            }
            set
            {
                if ((_startTimeDx != value))
                {
                    this.OnStartTimeDxChanging(value);
                    this.SendPropertyChanging();
                    this._startTimeDx = value;
                    this.SendPropertyChanged("StartTimeDx");
                    this.OnStartTimeDxChanged();
                }
            }
        }

        [Column(Storage = "_x", Name = "x", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> X
        {
            get
            {
                return this._x;
            }
            set
            {
                if ((_x != value))
                {
                    this.OnXChanging(value);
                    this.SendPropertyChanging();
                    this._x = value;
                    this.SendPropertyChanged("X");
                    this.OnXChanged();
                }
            }
        }

        [Column(Storage = "_y", Name = "y", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Y
        {
            get
            {
                return this._y;
            }
            set
            {
                if ((_y != value))
                {
                    this.OnYChanging(value);
                    this.SendPropertyChanging();
                    this._y = value;
                    this.SendPropertyChanged("Y");
                    this.OnYChanged();
                }
            }
        }

        [Column(Storage = "_z", Name = "z", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Z
        {
            get
            {
                return this._z;
            }
            set
            {
                if ((_z != value))
                {
                    this.OnZChanging(value);
                    this.SendPropertyChanging();
                    this._z = value;
                    this.SendPropertyChanged("Z");
                    this.OnZChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_oldreaderstate")]
    public partial class TOldReadersTate : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<double> _batteryThreshold;

        private System.Nullable<int> _frequency1;

        private System.Nullable<int> _frequency2;

        private System.Nullable<int> _frequency3;

        private int _id;

        private System.Nullable<short> _lampsTate;

        private System.Nullable<int> _power1;

        private System.Nullable<int> _power2;

        private System.Nullable<int> _power3;

        private string _programArea;

        private System.Nullable<long> _readerID;

        private string _receivesTate;

        private System.Nullable<System.DateTime> _recordTime;

        private System.Nullable<int> _reloginInterval;

        private System.Nullable<int> _sensitivity1;

        private System.Nullable<int> _sensitivity2;

        private System.Nullable<int> _sensitivity3;

        private string _state;

        private System.Nullable<int> _temperature;

        private System.Nullable<int> _uploadTimeInterval;

        private System.Nullable<int> _version;

        private System.Nullable<double> _voltage;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBatteryThresholdChanged();

        partial void OnBatteryThresholdChanging(System.Nullable<double> value);

        partial void OnFrequency1Changed();

        partial void OnFrequency1Changing(System.Nullable<int> value);

        partial void OnFrequency2Changed();

        partial void OnFrequency2Changing(System.Nullable<int> value);

        partial void OnFrequency3Changed();

        partial void OnFrequency3Changing(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnLampsTateChanged();

        partial void OnLampsTateChanging(System.Nullable<short> value);

        partial void OnPower1Changed();

        partial void OnPower1Changing(System.Nullable<int> value);

        partial void OnPower2Changed();

        partial void OnPower2Changing(System.Nullable<int> value);

        partial void OnPower3Changed();

        partial void OnPower3Changing(System.Nullable<int> value);

        partial void OnProgramAreaChanged();

        partial void OnProgramAreaChanging(string value);

        partial void OnReaderIDChanged();

        partial void OnReaderIDChanging(System.Nullable<long> value);

        partial void OnReceivesTateChanged();

        partial void OnReceivesTateChanging(string value);

        partial void OnRecordTimeChanged();

        partial void OnRecordTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnReloginIntervalChanged();

        partial void OnReloginIntervalChanging(System.Nullable<int> value);

        partial void OnSensitivity1Changed();

        partial void OnSensitivity1Changing(System.Nullable<int> value);

        partial void OnSensitivity2Changed();

        partial void OnSensitivity2Changing(System.Nullable<int> value);

        partial void OnSensitivity3Changed();

        partial void OnSensitivity3Changing(System.Nullable<int> value);

        partial void OnStateChanged();

        partial void OnStateChanging(string value);

        partial void OnTemperatureChanged();

        partial void OnTemperatureChanging(System.Nullable<int> value);

        partial void OnUploadTimeIntervalChanged();

        partial void OnUploadTimeIntervalChanging(System.Nullable<int> value);

        partial void OnVersionChanged();

        partial void OnVersionChanging(System.Nullable<int> value);

        partial void OnVoltageChanged();

        partial void OnVoltageChanging(System.Nullable<double> value);
        #endregion


        public TOldReadersTate()
        {
            this.OnCreated();
        }

        [Column(Storage = "_batteryThreshold", Name = "batteryThreshold", DbType = "double", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<double> BatteryThreshold
        {
            get
            {
                return this._batteryThreshold;
            }
            set
            {
                if ((_batteryThreshold != value))
                {
                    this.OnBatteryThresholdChanging(value);
                    this.SendPropertyChanging();
                    this._batteryThreshold = value;
                    this.SendPropertyChanged("BatteryThreshold");
                    this.OnBatteryThresholdChanged();
                }
            }
        }

        [Column(Storage = "_frequency1", Name = "frequency1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency1
        {
            get
            {
                return this._frequency1;
            }
            set
            {
                if ((_frequency1 != value))
                {
                    this.OnFrequency1Changing(value);
                    this.SendPropertyChanging();
                    this._frequency1 = value;
                    this.SendPropertyChanged("Frequency1");
                    this.OnFrequency1Changed();
                }
            }
        }

        [Column(Storage = "_frequency2", Name = "frequency2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency2
        {
            get
            {
                return this._frequency2;
            }
            set
            {
                if ((_frequency2 != value))
                {
                    this.OnFrequency2Changing(value);
                    this.SendPropertyChanging();
                    this._frequency2 = value;
                    this.SendPropertyChanged("Frequency2");
                    this.OnFrequency2Changed();
                }
            }
        }

        [Column(Storage = "_frequency3", Name = "frequency3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency3
        {
            get
            {
                return this._frequency3;
            }
            set
            {
                if ((_frequency3 != value))
                {
                    this.OnFrequency3Changing(value);
                    this.SendPropertyChanging();
                    this._frequency3 = value;
                    this.SendPropertyChanged("Frequency3");
                    this.OnFrequency3Changed();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int(20)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_lampsTate", Name = "lampstate", DbType = "smallint(6)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<short> LampsTate
        {
            get
            {
                return this._lampsTate;
            }
            set
            {
                if ((_lampsTate != value))
                {
                    this.OnLampsTateChanging(value);
                    this.SendPropertyChanging();
                    this._lampsTate = value;
                    this.SendPropertyChanged("LampsTate");
                    this.OnLampsTateChanged();
                }
            }
        }

        [Column(Storage = "_power1", Name = "power1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power1
        {
            get
            {
                return this._power1;
            }
            set
            {
                if ((_power1 != value))
                {
                    this.OnPower1Changing(value);
                    this.SendPropertyChanging();
                    this._power1 = value;
                    this.SendPropertyChanged("Power1");
                    this.OnPower1Changed();
                }
            }
        }

        [Column(Storage = "_power2", Name = "power2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power2
        {
            get
            {
                return this._power2;
            }
            set
            {
                if ((_power2 != value))
                {
                    this.OnPower2Changing(value);
                    this.SendPropertyChanging();
                    this._power2 = value;
                    this.SendPropertyChanged("Power2");
                    this.OnPower2Changed();
                }
            }
        }

        [Column(Storage = "_power3", Name = "power3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power3
        {
            get
            {
                return this._power3;
            }
            set
            {
                if ((_power3 != value))
                {
                    this.OnPower3Changing(value);
                    this.SendPropertyChanging();
                    this._power3 = value;
                    this.SendPropertyChanged("Power3");
                    this.OnPower3Changed();
                }
            }
        }

        [Column(Storage = "_programArea", Name = "programArea", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ProgramArea
        {
            get
            {
                return this._programArea;
            }
            set
            {
                if (((_programArea == value)
                            == false))
                {
                    this.OnProgramAreaChanging(value);
                    this.SendPropertyChanging();
                    this._programArea = value;
                    this.SendPropertyChanged("ProgramArea");
                    this.OnProgramAreaChanged();
                }
            }
        }

        [Column(Storage = "_readerID", Name = "readerId", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> ReaderID
        {
            get
            {
                return this._readerID;
            }
            set
            {
                if ((_readerID != value))
                {
                    this.OnReaderIDChanging(value);
                    this.SendPropertyChanging();
                    this._readerID = value;
                    this.SendPropertyChanged("ReaderID");
                    this.OnReaderIDChanged();
                }
            }
        }

        [Column(Storage = "_receivesTate", Name = "receivestate", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ReceivesTate
        {
            get
            {
                return this._receivesTate;
            }
            set
            {
                if (((_receivesTate == value)
                            == false))
                {
                    this.OnReceivesTateChanging(value);
                    this.SendPropertyChanging();
                    this._receivesTate = value;
                    this.SendPropertyChanged("ReceivesTate");
                    this.OnReceivesTateChanged();
                }
            }
        }

        [Column(Storage = "_recordTime", Name = "recordTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> RecordTime
        {
            get
            {
                return this._recordTime;
            }
            set
            {
                if ((_recordTime != value))
                {
                    this.OnRecordTimeChanging(value);
                    this.SendPropertyChanging();
                    this._recordTime = value;
                    this.SendPropertyChanged("RecordTime");
                    this.OnRecordTimeChanged();
                }
            }
        }

        [Column(Storage = "_reloginInterval", Name = "reloginInterval", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ReloginInterval
        {
            get
            {
                return this._reloginInterval;
            }
            set
            {
                if ((_reloginInterval != value))
                {
                    this.OnReloginIntervalChanging(value);
                    this.SendPropertyChanging();
                    this._reloginInterval = value;
                    this.SendPropertyChanged("ReloginInterval");
                    this.OnReloginIntervalChanged();
                }
            }
        }

        [Column(Storage = "_sensitivity1", Name = "sensitivity1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity1
        {
            get
            {
                return this._sensitivity1;
            }
            set
            {
                if ((_sensitivity1 != value))
                {
                    this.OnSensitivity1Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity1 = value;
                    this.SendPropertyChanged("Sensitivity1");
                    this.OnSensitivity1Changed();
                }
            }
        }

        [Column(Storage = "_sensitivity2", Name = "sensitivity2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity2
        {
            get
            {
                return this._sensitivity2;
            }
            set
            {
                if ((_sensitivity2 != value))
                {
                    this.OnSensitivity2Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity2 = value;
                    this.SendPropertyChanged("Sensitivity2");
                    this.OnSensitivity2Changed();
                }
            }
        }

        [Column(Storage = "_sensitivity3", Name = "sensitivity3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity3
        {
            get
            {
                return this._sensitivity3;
            }
            set
            {
                if ((_sensitivity3 != value))
                {
                    this.OnSensitivity3Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity3 = value;
                    this.SendPropertyChanged("Sensitivity3");
                    this.OnSensitivity3Changed();
                }
            }
        }

        [Column(Storage = "_state", Name = "state", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string State
        {
            get
            {
                return this._state;
            }
            set
            {
                if (((_state == value)
                            == false))
                {
                    this.OnStateChanging(value);
                    this.SendPropertyChanging();
                    this._state = value;
                    this.SendPropertyChanged("State");
                    this.OnStateChanged();
                }
            }
        }

        [Column(Storage = "_temperature", Name = "temperature", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Temperature
        {
            get
            {
                return this._temperature;
            }
            set
            {
                if ((_temperature != value))
                {
                    this.OnTemperatureChanging(value);
                    this.SendPropertyChanging();
                    this._temperature = value;
                    this.SendPropertyChanged("Temperature");
                    this.OnTemperatureChanged();
                }
            }
        }

        [Column(Storage = "_uploadTimeInterval", Name = "uploadTimeInterval", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> UploadTimeInterval
        {
            get
            {
                return this._uploadTimeInterval;
            }
            set
            {
                if ((_uploadTimeInterval != value))
                {
                    this.OnUploadTimeIntervalChanging(value);
                    this.SendPropertyChanging();
                    this._uploadTimeInterval = value;
                    this.SendPropertyChanged("UploadTimeInterval");
                    this.OnUploadTimeIntervalChanged();
                }
            }
        }

        [Column(Storage = "_version", Name = "version", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Version
        {
            get
            {
                return this._version;
            }
            set
            {
                if ((_version != value))
                {
                    this.OnVersionChanging(value);
                    this.SendPropertyChanging();
                    this._version = value;
                    this.SendPropertyChanged("Version");
                    this.OnVersionChanged();
                }
            }
        }

        [Column(Storage = "_voltage", Name = "voltage", DbType = "double", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<double> Voltage
        {
            get
            {
                return this._voltage;
            }
            set
            {
                if ((_voltage != value))
                {
                    this.OnVoltageChanging(value);
                    this.SendPropertyChanging();
                    this._voltage = value;
                    this.SendPropertyChanged("Voltage");
                    this.OnVoltageChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_order")]
    public partial class TOrder : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _description;

        private int _id;

        private string _name;

        private System.Nullable<int> _parentOrderID;

        private string _type;

        private EntitySet<TOrder> _idtoRder;

        private EntityRef<TOrder> _parentOrderIdtoRder = new EntityRef<TOrder>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnDescriptionChanged();

        partial void OnDescriptionChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnParentOrderIDChanged();

        partial void OnParentOrderIDChanging(System.Nullable<int> value);

        partial void OnTypeChanged();

        partial void OnTypeChanging(string value);
        #endregion


        public TOrder()
        {
            _idtoRder = new EntitySet<TOrder>(new Action<TOrder>(this.IDTOrder_Attach), new Action<TOrder>(this.IDTOrder_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_description", Name = "description", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Description
        {
            get
            {
                return this._description;
            }
            set
            {
                if (((_description == value)
                            == false))
                {
                    this.OnDescriptionChanging(value);
                    this.SendPropertyChanging();
                    this._description = value;
                    this.SendPropertyChanged("Description");
                    this.OnDescriptionChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_parentOrderID", Name = "parentOrderId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentOrderID
        {
            get
            {
                return this._parentOrderID;
            }
            set
            {
                if ((_parentOrderID != value))
                {
                    this.OnParentOrderIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentOrderID = value;
                    this.SendPropertyChanged("ParentOrderID");
                    this.OnParentOrderIDChanged();
                }
            }
        }

        [Column(Storage = "_type", Name = "type", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Type
        {
            get
            {
                return this._type;
            }
            set
            {
                if (((_type == value)
                            == false))
                {
                    this.OnTypeChanging(value);
                    this.SendPropertyChanging();
                    this._type = value;
                    this.SendPropertyChanged("Type");
                    this.OnTypeChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_idtoRder", OtherKey = "ParentOrderID", ThisKey = "ID", Name = "FKA0C0C3C3F6265BC8")]
        [DebuggerNonUserCode()]
        public EntitySet<TOrder> IDTOrder
        {
            get
            {
                return this._idtoRder;
            }
            set
            {
                this._idtoRder = value;
            }
        }
        #endregion

        #region Parents
        [Association(Storage = "_parentOrderIdtoRder", OtherKey = "ID", ThisKey = "ParentOrderID", Name = "FKA0C0C3C3F6265BC8", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TOrder ParentOrderIDTOrder
        {
            get
            {
                return this._parentOrderIdtoRder.Entity;
            }
            set
            {
                if (((this._parentOrderIdtoRder.Entity == value)
                            == false))
                {
                    if ((this._parentOrderIdtoRder.Entity != null))
                    {
                        TOrder previousTOrder = this._parentOrderIdtoRder.Entity;
                        this._parentOrderIdtoRder.Entity = null;
                        previousTOrder.IDTOrder.Remove(this);
                    }
                    this._parentOrderIdtoRder.Entity = value;
                    if ((value != null))
                    {
                        value.IDTOrder.Add(this);
                        _parentOrderID = value.ID;
                    }
                    else
                    {
                        _parentOrderID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void IDTOrder_Attach(TOrder entity)
        {
            this.SendPropertyChanging();
            entity.ParentOrderIDTOrder = this;
        }

        private void IDTOrder_Detach(TOrder entity)
        {
            this.SendPropertyChanging();
            entity.ParentOrderIDTOrder = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_organization")]
    public partial class TOrganization : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private System.Nullable<System.DateTime> _createTime;

        private System.Nullable<long> _createUserID;

        private int _id;

        private string _name;

        private string _note;

        private System.Nullable<int> _parentOrgID;

        private System.Nullable<int> _responPeople;

        private string _sort;

        private System.Nullable<int> _type;

        private System.Nullable<System.DateTime> _updateTime;

        private System.Nullable<long> _updateUserID;

        private EntitySet<TGivenClass> _tgIvenClass;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserIDChanged();

        partial void OnCreateUserIDChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnParentOrgIDChanged();

        partial void OnParentOrgIDChanging(System.Nullable<int> value);

        partial void OnResponPeopleChanged();

        partial void OnResponPeopleChanging(System.Nullable<int> value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnTypeChanged();

        partial void OnTypeChanging(System.Nullable<int> value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserIDChanged();

        partial void OnUpdateUserIDChanging(System.Nullable<long> value);
        #endregion


        public TOrganization()
        {
            _tgIvenClass = new EntitySet<TGivenClass>(new Action<TGivenClass>(this.TGivenClass_Attach), new Action<TGivenClass>(this.TGivenClass_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUserID", Name = "createUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CreateUserID
        {
            get
            {
                return this._createUserID;
            }
            set
            {
                if ((_createUserID != value))
                {
                    this.OnCreateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._createUserID = value;
                    this.SendPropertyChanged("CreateUserID");
                    this.OnCreateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_parentOrgID", Name = "parentOrgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentOrgID
        {
            get
            {
                return this._parentOrgID;
            }
            set
            {
                if ((_parentOrgID != value))
                {
                    this.OnParentOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentOrgID = value;
                    this.SendPropertyChanged("ParentOrgID");
                    this.OnParentOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_responPeople", Name = "responPeople", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ResponPeople
        {
            get
            {
                return this._responPeople;
            }
            set
            {
                if ((_responPeople != value))
                {
                    this.OnResponPeopleChanging(value);
                    this.SendPropertyChanging();
                    this._responPeople = value;
                    this.SendPropertyChanged("ResponPeople");
                    this.OnResponPeopleChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_type", Name = "type", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Type
        {
            get
            {
                return this._type;
            }
            set
            {
                if ((_type != value))
                {
                    this.OnTypeChanging(value);
                    this.SendPropertyChanging();
                    this._type = value;
                    this.SendPropertyChanged("Type");
                    this.OnTypeChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUserID", Name = "updateUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> UpdateUserID
        {
            get
            {
                return this._updateUserID;
            }
            set
            {
                if ((_updateUserID != value))
                {
                    this.OnUpdateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._updateUserID = value;
                    this.SendPropertyChanged("UpdateUserID");
                    this.OnUpdateUserIDChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tgIvenClass", OtherKey = "OrgID", ThisKey = "ID", Name = "FKBE8002EB4A6B1857")]
        [DebuggerNonUserCode()]
        public EntitySet<TGivenClass> TGivenClass
        {
            get
            {
                return this._tgIvenClass;
            }
            set
            {
                this._tgIvenClass = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TGivenClass_Attach(TGivenClass entity)
        {
            this.SendPropertyChanging();
            entity.TOrganization = this;
        }

        private void TGivenClass_Detach(TGivenClass entity)
        {
            this.SendPropertyChanging();
            entity.TOrganization = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_orgtype")]
    public partial class TOrGType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private System.Nullable<System.DateTime> _createTime;

        private System.Nullable<long> _createUserID;

        private System.Nullable<int> _flag;

        private int _id;

        private string _name;

        private string _note;

        private System.Nullable<int> _parentOrgID;

        private string _sort;

        private System.Nullable<System.DateTime> _updateTime;

        private System.Nullable<long> _updateUserID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserIDChanged();

        partial void OnCreateUserIDChanging(System.Nullable<long> value);

        partial void OnFlagChanged();

        partial void OnFlagChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnParentOrgIDChanged();

        partial void OnParentOrgIDChanging(System.Nullable<int> value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserIDChanged();

        partial void OnUpdateUserIDChanging(System.Nullable<long> value);
        #endregion


        public TOrGType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUserID", Name = "createUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CreateUserID
        {
            get
            {
                return this._createUserID;
            }
            set
            {
                if ((_createUserID != value))
                {
                    this.OnCreateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._createUserID = value;
                    this.SendPropertyChanged("CreateUserID");
                    this.OnCreateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_flag", Name = "flag", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Flag
        {
            get
            {
                return this._flag;
            }
            set
            {
                if ((_flag != value))
                {
                    this.OnFlagChanging(value);
                    this.SendPropertyChanging();
                    this._flag = value;
                    this.SendPropertyChanged("Flag");
                    this.OnFlagChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_parentOrgID", Name = "parentOrgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentOrgID
        {
            get
            {
                return this._parentOrgID;
            }
            set
            {
                if ((_parentOrgID != value))
                {
                    this.OnParentOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentOrgID = value;
                    this.SendPropertyChanged("ParentOrgID");
                    this.OnParentOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUserID", Name = "updateUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> UpdateUserID
        {
            get
            {
                return this._updateUserID;
            }
            set
            {
                if ((_updateUserID != value))
                {
                    this.OnUpdateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._updateUserID = value;
                    this.SendPropertyChanged("UpdateUserID");
                    this.OnUpdateUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_parent_card_owner")]
    public partial class TParentCardOwner : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<long> _cardCode;

        private int _id;

        private System.Nullable<int> _parentID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardCodeChanged();

        partial void OnCardCodeChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnParentIDChanged();

        partial void OnParentIDChanging(System.Nullable<int> value);
        #endregion


        public TParentCardOwner()
        {
            this.OnCreated();
        }

        [Column(Storage = "_cardCode", Name = "cardCode", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardCode
        {
            get
            {
                return this._cardCode;
            }
            set
            {
                if ((_cardCode != value))
                {
                    this.OnCardCodeChanging(value);
                    this.SendPropertyChanging();
                    this._cardCode = value;
                    this.SendPropertyChanged("CardCode");
                    this.OnCardCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_parentID", Name = "parentId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentID
        {
            get
            {
                return this._parentID;
            }
            set
            {
                if ((_parentID != value))
                {
                    this.OnParentIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentID = value;
                    this.SendPropertyChanged("ParentID");
                    this.OnParentIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_parents")]
    public partial class TParents : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _birthday;

        private System.Nullable<System.DateTime> _createTime;

        private string _createUser;

        private string _email;

        private int _id;

        private string _identityNum;

        private string _imagePath;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _parentsName;

        private string _parentsNum;

        private string _phone;

        private string _sex;

        private string _sort;

        private System.Nullable<int> _stafftypeID;

        private string _staffTypeName;

        private System.Nullable<System.DateTime> _updateTime;

        private string _updateUser;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBirthdayChanged();

        partial void OnBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(string value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIdentityNumChanged();

        partial void OnIdentityNumChanging(string value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnParentsNameChanged();

        partial void OnParentsNameChanging(string value);

        partial void OnParentsNumChanged();

        partial void OnParentsNumChanging(string value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnStaffTypeNameChanged();

        partial void OnStaffTypeNameChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(string value);
        #endregion


        public TParents()
        {
            this.OnCreated();
        }

        [Column(Storage = "_birthday", Name = "birthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> Birthday
        {
            get
            {
                return this._birthday;
            }
            set
            {
                if ((_birthday != value))
                {
                    this.OnBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._birthday = value;
                    this.SendPropertyChanged("Birthday");
                    this.OnBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if (((_createUser == value)
                            == false))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_identityNum", Name = "identityNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string IdentityNum
        {
            get
            {
                return this._identityNum;
            }
            set
            {
                if (((_identityNum == value)
                            == false))
                {
                    this.OnIdentityNumChanging(value);
                    this.SendPropertyChanging();
                    this._identityNum = value;
                    this.SendPropertyChanged("IdentityNum");
                    this.OnIdentityNumChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_parentsName", Name = "parentsName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ParentsName
        {
            get
            {
                return this._parentsName;
            }
            set
            {
                if (((_parentsName == value)
                            == false))
                {
                    this.OnParentsNameChanging(value);
                    this.SendPropertyChanging();
                    this._parentsName = value;
                    this.SendPropertyChanged("ParentsName");
                    this.OnParentsNameChanged();
                }
            }
        }

        [Column(Storage = "_parentsNum", Name = "parentsNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ParentsNum
        {
            get
            {
                return this._parentsNum;
            }
            set
            {
                if (((_parentsNum == value)
                            == false))
                {
                    this.OnParentsNumChanging(value);
                    this.SendPropertyChanging();
                    this._parentsNum = value;
                    this.SendPropertyChanged("ParentsNum");
                    this.OnParentsNumChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_staffTypeName", Name = "staffTypeName", DbType = "varchar(30)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffTypeName
        {
            get
            {
                return this._staffTypeName;
            }
            set
            {
                if (((_staffTypeName == value)
                            == false))
                {
                    this.OnStaffTypeNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffTypeName = value;
                    this.SendPropertyChanged("StaffTypeName");
                    this.OnStaffTypeNameChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if (((_updateUser == value)
                            == false))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_parentsstu")]
    public partial class TParentsStu : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _id;

        private System.Nullable<int> _parentsID;

        private System.Nullable<int> _studentID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnParentsIDChanged();

        partial void OnParentsIDChanging(System.Nullable<int> value);

        partial void OnStudentIDChanged();

        partial void OnStudentIDChanging(System.Nullable<int> value);
        #endregion


        public TParentsStu()
        {
            this.OnCreated();
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_parentsID", Name = "parentsId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ParentsID
        {
            get
            {
                return this._parentsID;
            }
            set
            {
                if ((_parentsID != value))
                {
                    this.OnParentsIDChanging(value);
                    this.SendPropertyChanging();
                    this._parentsID = value;
                    this.SendPropertyChanged("ParentsID");
                    this.OnParentsIDChanged();
                }
            }
        }

        [Column(Storage = "_studentID", Name = "studentId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StudentID
        {
            get
            {
                return this._studentID;
            }
            set
            {
                if ((_studentID != value))
                {
                    this.OnStudentIDChanging(value);
                    this.SendPropertyChanging();
                    this._studentID = value;
                    this.SendPropertyChanged("StudentID");
                    this.OnStudentIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_privilege")]
    public partial class TPrivilege : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<bool> _enabled;

        private System.Nullable<int> _functionID;

        private int _id;

        private System.Nullable<bool> _isSys;

        private string _name;

        private string _nameDesc;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnEnabledChanged();

        partial void OnEnabledChanging(System.Nullable<bool> value);

        partial void OnFunctionIDChanged();

        partial void OnFunctionIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIsSysChanged();

        partial void OnIsSysChanging(System.Nullable<bool> value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNameDescChanged();

        partial void OnNameDescChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TPrivilege()
        {
            this.OnCreated();
        }

        [Column(Storage = "_enabled", Name = "enabled", DbType = "bit(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<bool> Enabled
        {
            get
            {
                return this._enabled;
            }
            set
            {
                if ((_enabled != value))
                {
                    this.OnEnabledChanging(value);
                    this.SendPropertyChanging();
                    this._enabled = value;
                    this.SendPropertyChanged("Enabled");
                    this.OnEnabledChanged();
                }
            }
        }

        [Column(Storage = "_functionID", Name = "functionId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> FunctionID
        {
            get
            {
                return this._functionID;
            }
            set
            {
                if ((_functionID != value))
                {
                    this.OnFunctionIDChanging(value);
                    this.SendPropertyChanging();
                    this._functionID = value;
                    this.SendPropertyChanged("FunctionID");
                    this.OnFunctionIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_isSys", Name = "isSys", DbType = "bit(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<bool> IsSys
        {
            get
            {
                return this._isSys;
            }
            set
            {
                if ((_isSys != value))
                {
                    this.OnIsSysChanging(value);
                    this.SendPropertyChanging();
                    this._isSys = value;
                    this.SendPropertyChanged("IsSys");
                    this.OnIsSysChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_nameDesc", Name = "nameDesc", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string NameDesc
        {
            get
            {
                return this._nameDesc;
            }
            set
            {
                if (((_nameDesc == value)
                            == false))
                {
                    this.OnNameDescChanging(value);
                    this.SendPropertyChanging();
                    this._nameDesc = value;
                    this.SendPropertyChanged("NameDesc");
                    this.OnNameDescChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_reader")]
    public partial class TReader : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _busID;

        private System.Nullable<long> _code;

        private int _id;

        private string _latitude;

        private string _longitude;

        private string _note;

        private System.Nullable<int> _orgID;

        private System.Nullable<int> _state;

        private System.Nullable<int> _typeID;

        private EntitySet<TCardReader> _tcArdReader;

        private EntitySet<TLocateData> _tlOcateData;

        private EntitySet<TReadersTate> _trEadersTate;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBusIDChanged();

        partial void OnBusIDChanging(System.Nullable<int> value);

        partial void OnCodeChanged();

        partial void OnCodeChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnLatitudeChanged();

        partial void OnLatitudeChanging(string value);

        partial void OnLongitudeChanged();

        partial void OnLongitudeChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnStateChanged();

        partial void OnStateChanging(System.Nullable<int> value);

        partial void OnTypeIDChanged();

        partial void OnTypeIDChanging(System.Nullable<int> value);
        #endregion


        public TReader()
        {
            _tcArdReader = new EntitySet<TCardReader>(new Action<TCardReader>(this.TCardReader_Attach), new Action<TCardReader>(this.TCardReader_Detach));
            _tlOcateData = new EntitySet<TLocateData>(new Action<TLocateData>(this.TLocateData_Attach), new Action<TLocateData>(this.TLocateData_Detach));
            _trEadersTate = new EntitySet<TReadersTate>(new Action<TReadersTate>(this.TReadersTate_Attach), new Action<TReadersTate>(this.TReadersTate_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_busID", Name = "busId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> BusID
        {
            get
            {
                return this._busID;
            }
            set
            {
                if ((_busID != value))
                {
                    this.OnBusIDChanging(value);
                    this.SendPropertyChanging();
                    this._busID = value;
                    this.SendPropertyChanged("BusID");
                    this.OnBusIDChanged();
                }
            }
        }

        [Column(Storage = "_code", Name = "code", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if ((_code != value))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_latitude", Name = "latitude", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Latitude
        {
            get
            {
                return this._latitude;
            }
            set
            {
                if (((_latitude == value)
                            == false))
                {
                    this.OnLatitudeChanging(value);
                    this.SendPropertyChanging();
                    this._latitude = value;
                    this.SendPropertyChanged("Latitude");
                    this.OnLatitudeChanged();
                }
            }
        }

        [Column(Storage = "_longitude", Name = "longitude", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Longitude
        {
            get
            {
                return this._longitude;
            }
            set
            {
                if (((_longitude == value)
                            == false))
                {
                    this.OnLongitudeChanging(value);
                    this.SendPropertyChanging();
                    this._longitude = value;
                    this.SendPropertyChanged("Longitude");
                    this.OnLongitudeChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_state", Name = "state", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> State
        {
            get
            {
                return this._state;
            }
            set
            {
                if ((_state != value))
                {
                    this.OnStateChanging(value);
                    this.SendPropertyChanging();
                    this._state = value;
                    this.SendPropertyChanged("State");
                    this.OnStateChanged();
                }
            }
        }

        [Column(Storage = "_typeID", Name = "typeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> TypeID
        {
            get
            {
                return this._typeID;
            }
            set
            {
                if ((_typeID != value))
                {
                    this.OnTypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._typeID = value;
                    this.SendPropertyChanged("TypeID");
                    this.OnTypeIDChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tcArdReader", OtherKey = "ReaderID", ThisKey = "Code", Name = "FK16B499876BEA590F")]
        [DebuggerNonUserCode()]
        public EntitySet<TCardReader> TCardReader
        {
            get
            {
                return this._tcArdReader;
            }
            set
            {
                this._tcArdReader = value;
            }
        }

        [Association(Storage = "_tlOcateData", OtherKey = "ReaderID", ThisKey = "Code", Name = "FK19064AA76BEA590F")]
        [DebuggerNonUserCode()]
        public EntitySet<TLocateData> TLocateData
        {
            get
            {
                return this._tlOcateData;
            }
            set
            {
                this._tlOcateData = value;
            }
        }

        [Association(Storage = "_trEadersTate", OtherKey = "ID", ThisKey = "Code", Name = "FK6E8BE639F98250C")]
        [DebuggerNonUserCode()]
        public EntitySet<TReadersTate> TReadersTate
        {
            get
            {
                return this._trEadersTate;
            }
            set
            {
                this._trEadersTate = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TCardReader_Attach(TCardReader entity)
        {
            this.SendPropertyChanging();
            entity.TReader = this;
        }

        private void TCardReader_Detach(TCardReader entity)
        {
            this.SendPropertyChanging();
            entity.TReader = null;
        }

        private void TLocateData_Attach(TLocateData entity)
        {
            this.SendPropertyChanging();
            entity.TReader = this;
        }

        private void TLocateData_Detach(TLocateData entity)
        {
            this.SendPropertyChanging();
            entity.TReader = null;
        }

        private void TReadersTate_Attach(TReadersTate entity)
        {
            this.SendPropertyChanging();
            entity.TReader = this;
        }

        private void TReadersTate_Detach(TReadersTate entity)
        {
            this.SendPropertyChanging();
            entity.TReader = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_readerstate")]
    public partial class TReadersTate : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<double> _batteryThreshold;

        private System.Nullable<int> _frequency1;

        private System.Nullable<int> _frequency2;

        private System.Nullable<int> _frequency3;

        private long _id;

        private System.Nullable<short> _lampState;

        private System.Nullable<int> _power1;

        private System.Nullable<int> _power2;

        private System.Nullable<int> _power3;

        private string _programArea;

        private string _receivesTate;

        private System.Nullable<System.DateTime> _recordTime;

        private System.Nullable<int> _reloginInterval;

        private System.Nullable<int> _sensitivity1;

        private System.Nullable<int> _sensitivity2;

        private System.Nullable<int> _sensitivity3;

        private string _state;

        private System.Nullable<int> _temperature;

        private System.Nullable<int> _uploadTimeInterval;

        private System.Nullable<int> _version;

        private System.Nullable<double> _voltage;

        private EntityRef<TReader> _trEader = new EntityRef<TReader>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBatteryThresholdChanged();

        partial void OnBatteryThresholdChanging(System.Nullable<double> value);

        partial void OnFrequency1Changed();

        partial void OnFrequency1Changing(System.Nullable<int> value);

        partial void OnFrequency2Changed();

        partial void OnFrequency2Changing(System.Nullable<int> value);

        partial void OnFrequency3Changed();

        partial void OnFrequency3Changing(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(long value);

        partial void OnLampStateChanged();

        partial void OnLampStateChanging(System.Nullable<short> value);

        partial void OnPower1Changed();

        partial void OnPower1Changing(System.Nullable<int> value);

        partial void OnPower2Changed();

        partial void OnPower2Changing(System.Nullable<int> value);

        partial void OnPower3Changed();

        partial void OnPower3Changing(System.Nullable<int> value);

        partial void OnProgramAreaChanged();

        partial void OnProgramAreaChanging(string value);

        partial void OnReceivesTateChanged();

        partial void OnReceivesTateChanging(string value);

        partial void OnRecordTimeChanged();

        partial void OnRecordTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnReloginIntervalChanged();

        partial void OnReloginIntervalChanging(System.Nullable<int> value);

        partial void OnSensitivity1Changed();

        partial void OnSensitivity1Changing(System.Nullable<int> value);

        partial void OnSensitivity2Changed();

        partial void OnSensitivity2Changing(System.Nullable<int> value);

        partial void OnSensitivity3Changed();

        partial void OnSensitivity3Changing(System.Nullable<int> value);

        partial void OnStateChanged();

        partial void OnStateChanging(string value);

        partial void OnTemperatureChanged();

        partial void OnTemperatureChanging(System.Nullable<int> value);

        partial void OnUploadTimeIntervalChanged();

        partial void OnUploadTimeIntervalChanging(System.Nullable<int> value);

        partial void OnVersionChanged();

        partial void OnVersionChanging(System.Nullable<int> value);

        partial void OnVoltageChanged();

        partial void OnVoltageChanging(System.Nullable<double> value);
        #endregion


        public TReadersTate()
        {
            this.OnCreated();
        }

        [Column(Storage = "_batteryThreshold", Name = "batteryThreshold", DbType = "double", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<double> BatteryThreshold
        {
            get
            {
                return this._batteryThreshold;
            }
            set
            {
                if ((_batteryThreshold != value))
                {
                    this.OnBatteryThresholdChanging(value);
                    this.SendPropertyChanging();
                    this._batteryThreshold = value;
                    this.SendPropertyChanged("BatteryThreshold");
                    this.OnBatteryThresholdChanged();
                }
            }
        }

        [Column(Storage = "_frequency1", Name = "frequency1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency1
        {
            get
            {
                return this._frequency1;
            }
            set
            {
                if ((_frequency1 != value))
                {
                    this.OnFrequency1Changing(value);
                    this.SendPropertyChanging();
                    this._frequency1 = value;
                    this.SendPropertyChanged("Frequency1");
                    this.OnFrequency1Changed();
                }
            }
        }

        [Column(Storage = "_frequency2", Name = "frequency2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency2
        {
            get
            {
                return this._frequency2;
            }
            set
            {
                if ((_frequency2 != value))
                {
                    this.OnFrequency2Changing(value);
                    this.SendPropertyChanging();
                    this._frequency2 = value;
                    this.SendPropertyChanged("Frequency2");
                    this.OnFrequency2Changed();
                }
            }
        }

        [Column(Storage = "_frequency3", Name = "frequency3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Frequency3
        {
            get
            {
                return this._frequency3;
            }
            set
            {
                if ((_frequency3 != value))
                {
                    this.OnFrequency3Changing(value);
                    this.SendPropertyChanging();
                    this._frequency3 = value;
                    this.SendPropertyChanged("Frequency3");
                    this.OnFrequency3Changed();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "bigint(20)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public long ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_lampState", Name = "lampState", DbType = "smallint(6)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<short> LampState
        {
            get
            {
                return this._lampState;
            }
            set
            {
                if ((_lampState != value))
                {
                    this.OnLampStateChanging(value);
                    this.SendPropertyChanging();
                    this._lampState = value;
                    this.SendPropertyChanged("LampState");
                    this.OnLampStateChanged();
                }
            }
        }

        [Column(Storage = "_power1", Name = "power1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power1
        {
            get
            {
                return this._power1;
            }
            set
            {
                if ((_power1 != value))
                {
                    this.OnPower1Changing(value);
                    this.SendPropertyChanging();
                    this._power1 = value;
                    this.SendPropertyChanged("Power1");
                    this.OnPower1Changed();
                }
            }
        }

        [Column(Storage = "_power2", Name = "power2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power2
        {
            get
            {
                return this._power2;
            }
            set
            {
                if ((_power2 != value))
                {
                    this.OnPower2Changing(value);
                    this.SendPropertyChanging();
                    this._power2 = value;
                    this.SendPropertyChanged("Power2");
                    this.OnPower2Changed();
                }
            }
        }

        [Column(Storage = "_power3", Name = "power3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Power3
        {
            get
            {
                return this._power3;
            }
            set
            {
                if ((_power3 != value))
                {
                    this.OnPower3Changing(value);
                    this.SendPropertyChanging();
                    this._power3 = value;
                    this.SendPropertyChanged("Power3");
                    this.OnPower3Changed();
                }
            }
        }

        [Column(Storage = "_programArea", Name = "programArea", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ProgramArea
        {
            get
            {
                return this._programArea;
            }
            set
            {
                if (((_programArea == value)
                            == false))
                {
                    this.OnProgramAreaChanging(value);
                    this.SendPropertyChanging();
                    this._programArea = value;
                    this.SendPropertyChanged("ProgramArea");
                    this.OnProgramAreaChanged();
                }
            }
        }

        [Column(Storage = "_receivesTate", Name = "receivestate", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ReceivesTate
        {
            get
            {
                return this._receivesTate;
            }
            set
            {
                if (((_receivesTate == value)
                            == false))
                {
                    this.OnReceivesTateChanging(value);
                    this.SendPropertyChanging();
                    this._receivesTate = value;
                    this.SendPropertyChanged("ReceivesTate");
                    this.OnReceivesTateChanged();
                }
            }
        }

        [Column(Storage = "_recordTime", Name = "recordTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> RecordTime
        {
            get
            {
                return this._recordTime;
            }
            set
            {
                if ((_recordTime != value))
                {
                    this.OnRecordTimeChanging(value);
                    this.SendPropertyChanging();
                    this._recordTime = value;
                    this.SendPropertyChanged("RecordTime");
                    this.OnRecordTimeChanged();
                }
            }
        }

        [Column(Storage = "_reloginInterval", Name = "reloginInterval", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> ReloginInterval
        {
            get
            {
                return this._reloginInterval;
            }
            set
            {
                if ((_reloginInterval != value))
                {
                    this.OnReloginIntervalChanging(value);
                    this.SendPropertyChanging();
                    this._reloginInterval = value;
                    this.SendPropertyChanged("ReloginInterval");
                    this.OnReloginIntervalChanged();
                }
            }
        }

        [Column(Storage = "_sensitivity1", Name = "sensitivity1", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity1
        {
            get
            {
                return this._sensitivity1;
            }
            set
            {
                if ((_sensitivity1 != value))
                {
                    this.OnSensitivity1Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity1 = value;
                    this.SendPropertyChanged("Sensitivity1");
                    this.OnSensitivity1Changed();
                }
            }
        }

        [Column(Storage = "_sensitivity2", Name = "sensitivity2", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity2
        {
            get
            {
                return this._sensitivity2;
            }
            set
            {
                if ((_sensitivity2 != value))
                {
                    this.OnSensitivity2Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity2 = value;
                    this.SendPropertyChanged("Sensitivity2");
                    this.OnSensitivity2Changed();
                }
            }
        }

        [Column(Storage = "_sensitivity3", Name = "sensitivity3", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Sensitivity3
        {
            get
            {
                return this._sensitivity3;
            }
            set
            {
                if ((_sensitivity3 != value))
                {
                    this.OnSensitivity3Changing(value);
                    this.SendPropertyChanging();
                    this._sensitivity3 = value;
                    this.SendPropertyChanged("Sensitivity3");
                    this.OnSensitivity3Changed();
                }
            }
        }

        [Column(Storage = "_state", Name = "state", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string State
        {
            get
            {
                return this._state;
            }
            set
            {
                if (((_state == value)
                            == false))
                {
                    this.OnStateChanging(value);
                    this.SendPropertyChanging();
                    this._state = value;
                    this.SendPropertyChanged("State");
                    this.OnStateChanged();
                }
            }
        }

        [Column(Storage = "_temperature", Name = "temperature", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Temperature
        {
            get
            {
                return this._temperature;
            }
            set
            {
                if ((_temperature != value))
                {
                    this.OnTemperatureChanging(value);
                    this.SendPropertyChanging();
                    this._temperature = value;
                    this.SendPropertyChanged("Temperature");
                    this.OnTemperatureChanged();
                }
            }
        }

        [Column(Storage = "_uploadTimeInterval", Name = "uploadTimeInterval", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> UploadTimeInterval
        {
            get
            {
                return this._uploadTimeInterval;
            }
            set
            {
                if ((_uploadTimeInterval != value))
                {
                    this.OnUploadTimeIntervalChanging(value);
                    this.SendPropertyChanging();
                    this._uploadTimeInterval = value;
                    this.SendPropertyChanged("UploadTimeInterval");
                    this.OnUploadTimeIntervalChanged();
                }
            }
        }

        [Column(Storage = "_version", Name = "version", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Version
        {
            get
            {
                return this._version;
            }
            set
            {
                if ((_version != value))
                {
                    this.OnVersionChanging(value);
                    this.SendPropertyChanging();
                    this._version = value;
                    this.SendPropertyChanged("Version");
                    this.OnVersionChanged();
                }
            }
        }

        [Column(Storage = "_voltage", Name = "voltage", DbType = "double", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<double> Voltage
        {
            get
            {
                return this._voltage;
            }
            set
            {
                if ((_voltage != value))
                {
                    this.OnVoltageChanging(value);
                    this.SendPropertyChanging();
                    this._voltage = value;
                    this.SendPropertyChanged("Voltage");
                    this.OnVoltageChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_trEader", OtherKey = "Code", ThisKey = "ID", Name = "FK6E8BE639F98250C", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TReader TReader
        {
            get
            {
                return this._trEader.Entity;
            }
            set
            {
                if (((this._trEader.Entity == value)
                            == false))
                {
                    if ((this._trEader.Entity != null))
                    {
                        TReader previousTReader = this._trEader.Entity;
                        this._trEader.Entity = null;
                        previousTReader.TReadersTate.Remove(this);
                    }
                    this._trEader.Entity = value;
                    if ((value != null))
                    {
                        value.TReadersTate.Add(this);
                        _id = (long)value.Code;
                    }
                    else
                    {
                        _id = default(long);
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_resource")]
    public partial class TResource : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private bool _enabled;

        private System.Nullable<int> _functionID;

        private int _id;

        private bool _isSys;

        private string _name;

        private string _note;

        private string _resourceUrl;

        private EntityRef<TFunctionInfo> _tfUnctionInfo = new EntityRef<TFunctionInfo>();

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnEnabledChanged();

        partial void OnEnabledChanging(bool value);

        partial void OnFunctionIDChanged();

        partial void OnFunctionIDChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIsSysChanged();

        partial void OnIsSysChanging(bool value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnResourceUrlChanged();

        partial void OnResourceUrlChanging(string value);
        #endregion


        public TResource()
        {
            this.OnCreated();
        }

        [Column(Storage = "_enabled", Name = "enabled", DbType = "bit(1)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public bool Enabled
        {
            get
            {
                return this._enabled;
            }
            set
            {
                if ((_enabled != value))
                {
                    this.OnEnabledChanging(value);
                    this.SendPropertyChanging();
                    this._enabled = value;
                    this.SendPropertyChanged("Enabled");
                    this.OnEnabledChanged();
                }
            }
        }

        [Column(Storage = "_functionID", Name = "functionId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> FunctionID
        {
            get
            {
                return this._functionID;
            }
            set
            {
                if ((_functionID != value))
                {
                    this.OnFunctionIDChanging(value);
                    this.SendPropertyChanging();
                    this._functionID = value;
                    this.SendPropertyChanged("FunctionID");
                    this.OnFunctionIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_isSys", Name = "isSys", DbType = "bit(1)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public bool IsSys
        {
            get
            {
                return this._isSys;
            }
            set
            {
                if ((_isSys != value))
                {
                    this.OnIsSysChanging(value);
                    this.SendPropertyChanging();
                    this._isSys = value;
                    this.SendPropertyChanged("IsSys");
                    this.OnIsSysChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_resourceUrl", Name = "resourceUrl", DbType = "varchar(50)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string ResourceUrl
        {
            get
            {
                return this._resourceUrl;
            }
            set
            {
                if (((_resourceUrl == value)
                            == false))
                {
                    this.OnResourceUrlChanging(value);
                    this.SendPropertyChanging();
                    this._resourceUrl = value;
                    this.SendPropertyChanged("ResourceUrl");
                    this.OnResourceUrlChanged();
                }
            }
        }

        #region Parents
        [Association(Storage = "_tfUnctionInfo", OtherKey = "ID", ThisKey = "FunctionID", Name = "FKA2583779C2F55798", IsForeignKey = true)]
        [DebuggerNonUserCode()]
        public TFunctionInfo TFunctionInfo
        {
            get
            {
                return this._tfUnctionInfo.Entity;
            }
            set
            {
                if (((this._tfUnctionInfo.Entity == value)
                            == false))
                {
                    if ((this._tfUnctionInfo.Entity != null))
                    {
                        TFunctionInfo previousTFunctionInfo = this._tfUnctionInfo.Entity;
                        this._tfUnctionInfo.Entity = null;
                        previousTFunctionInfo.TResource.Remove(this);
                    }
                    this._tfUnctionInfo.Entity = value;
                    if ((value != null))
                    {
                        value.TResource.Add(this);
                        _functionID = value.ID;
                    }
                    else
                    {
                        _functionID = null;
                    }
                }
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_resource_priviilege")]
    public partial class TResourcePRiViILegE : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _privilegeID;

        private int _resourceID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnPrivilegeIDChanged();

        partial void OnPrivilegeIDChanging(int value);

        partial void OnResourceIDChanged();

        partial void OnResourceIDChanging(int value);
        #endregion


        public TResourcePRiViILegE()
        {
            this.OnCreated();
        }

        [Column(Storage = "_privilegeID", Name = "privilegeId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int PrivilegeID
        {
            get
            {
                return this._privilegeID;
            }
            set
            {
                if ((_privilegeID != value))
                {
                    this.OnPrivilegeIDChanging(value);
                    this.SendPropertyChanging();
                    this._privilegeID = value;
                    this.SendPropertyChanged("PrivilegeID");
                    this.OnPrivilegeIDChanged();
                }
            }
        }

        [Column(Storage = "_resourceID", Name = "resourceId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ResourceID
        {
            get
            {
                return this._resourceID;
            }
            set
            {
                if ((_resourceID != value))
                {
                    this.OnResourceIDChanging(value);
                    this.SendPropertyChanging();
                    this._resourceID = value;
                    this.SendPropertyChanged("ResourceID");
                    this.OnResourceIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_role")]
    public partial class TRole : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _createTime;

        private System.Nullable<long> _createUserID;

        private int _id;

        private string _name;

        private string _nameDesc;

        private string _note;

        private System.Nullable<int> _organizationID;

        private System.Nullable<System.DateTime> _updateTime;

        private System.Nullable<long> _updateUserID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserIDChanged();

        partial void OnCreateUserIDChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNameDescChanged();

        partial void OnNameDescChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrganizationIDChanged();

        partial void OnOrganizationIDChanging(System.Nullable<int> value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserIDChanged();

        partial void OnUpdateUserIDChanging(System.Nullable<long> value);
        #endregion


        public TRole()
        {
            this.OnCreated();
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUserID", Name = "createUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CreateUserID
        {
            get
            {
                return this._createUserID;
            }
            set
            {
                if ((_createUserID != value))
                {
                    this.OnCreateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._createUserID = value;
                    this.SendPropertyChanged("CreateUserID");
                    this.OnCreateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_nameDesc", Name = "nameDesc", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string NameDesc
        {
            get
            {
                return this._nameDesc;
            }
            set
            {
                if (((_nameDesc == value)
                            == false))
                {
                    this.OnNameDescChanging(value);
                    this.SendPropertyChanging();
                    this._nameDesc = value;
                    this.SendPropertyChanged("NameDesc");
                    this.OnNameDescChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_organizationID", Name = "organizationId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrganizationID
        {
            get
            {
                return this._organizationID;
            }
            set
            {
                if ((_organizationID != value))
                {
                    this.OnOrganizationIDChanging(value);
                    this.SendPropertyChanging();
                    this._organizationID = value;
                    this.SendPropertyChanged("OrganizationID");
                    this.OnOrganizationIDChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUserID", Name = "updateUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> UpdateUserID
        {
            get
            {
                return this._updateUserID;
            }
            set
            {
                if ((_updateUserID != value))
                {
                    this.OnUpdateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._updateUserID = value;
                    this.SendPropertyChanged("UpdateUserID");
                    this.OnUpdateUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_role_privilege")]
    public partial class TRolePrivilege : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _privilegeID;

        private int _roleID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnPrivilegeIDChanged();

        partial void OnPrivilegeIDChanging(int value);

        partial void OnRoleIDChanged();

        partial void OnRoleIDChanging(int value);
        #endregion


        public TRolePrivilege()
        {
            this.OnCreated();
        }

        [Column(Storage = "_privilegeID", Name = "privilegeId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int PrivilegeID
        {
            get
            {
                return this._privilegeID;
            }
            set
            {
                if ((_privilegeID != value))
                {
                    this.OnPrivilegeIDChanging(value);
                    this.SendPropertyChanging();
                    this._privilegeID = value;
                    this.SendPropertyChanged("PrivilegeID");
                    this.OnPrivilegeIDChanged();
                }
            }
        }

        [Column(Storage = "_roleID", Name = "roleId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RoleID
        {
            get
            {
                return this._roleID;
            }
            set
            {
                if ((_roleID != value))
                {
                    this.OnRoleIDChanging(value);
                    this.SendPropertyChanging();
                    this._roleID = value;
                    this.SendPropertyChanged("RoleID");
                    this.OnRoleIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_staff")]
    public partial class TStaff : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _birthday;

        private System.Nullable<System.DateTime> _createTime;

        private string _createUser;

        private string _email;

        private int _id;

        private string _identityNum;

        private string _imagePath;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _phone;

        private string _sex;

        private string _sort;

        private string _staffName;

        private string _staffNum;

        private System.Nullable<int> _stafftypeID;

        private string _staffTypeName;

        private System.Nullable<System.DateTime> _updateTime;

        private string _updateUser;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBirthdayChanged();

        partial void OnBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(string value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIdentityNumChanged();

        partial void OnIdentityNumChanging(string value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStaffNameChanged();

        partial void OnStaffNameChanging(string value);

        partial void OnStaffNumChanged();

        partial void OnStaffNumChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnStaffTypeNameChanged();

        partial void OnStaffTypeNameChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(string value);
        #endregion


        public TStaff()
        {
            this.OnCreated();
        }

        [Column(Storage = "_birthday", Name = "birthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> Birthday
        {
            get
            {
                return this._birthday;
            }
            set
            {
                if ((_birthday != value))
                {
                    this.OnBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._birthday = value;
                    this.SendPropertyChanged("Birthday");
                    this.OnBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if (((_createUser == value)
                            == false))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_identityNum", Name = "identityNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string IdentityNum
        {
            get
            {
                return this._identityNum;
            }
            set
            {
                if (((_identityNum == value)
                            == false))
                {
                    this.OnIdentityNumChanging(value);
                    this.SendPropertyChanging();
                    this._identityNum = value;
                    this.SendPropertyChanged("IdentityNum");
                    this.OnIdentityNumChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_staffName", Name = "staffName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffName
        {
            get
            {
                return this._staffName;
            }
            set
            {
                if (((_staffName == value)
                            == false))
                {
                    this.OnStaffNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffName = value;
                    this.SendPropertyChanged("StaffName");
                    this.OnStaffNameChanged();
                }
            }
        }

        [Column(Storage = "_staffNum", Name = "staffNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffNum
        {
            get
            {
                return this._staffNum;
            }
            set
            {
                if (((_staffNum == value)
                            == false))
                {
                    this.OnStaffNumChanging(value);
                    this.SendPropertyChanging();
                    this._staffNum = value;
                    this.SendPropertyChanged("StaffNum");
                    this.OnStaffNumChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_staffTypeName", Name = "staffTypeName", DbType = "varchar(30)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffTypeName
        {
            get
            {
                return this._staffTypeName;
            }
            set
            {
                if (((_staffTypeName == value)
                            == false))
                {
                    this.OnStaffTypeNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffTypeName = value;
                    this.SendPropertyChanged("StaffTypeName");
                    this.OnStaffTypeNameChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if (((_updateUser == value)
                            == false))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_staff_type")]
    public partial class TStaffType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<int> _code;

        private int _id;

        private string _name;

        private string _note;

        private EntitySet<TBusStaffMan> _tbUsStaffMan;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(System.Nullable<int> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TStaffType()
        {
            _tbUsStaffMan = new EntitySet<TBusStaffMan>(new Action<TBusStaffMan>(this.TBusStaffMan_Attach), new Action<TBusStaffMan>(this.TBusStaffMan_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if ((_code != value))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tbUsStaffMan", OtherKey = "StafftypeID", ThisKey = "ID", Name = "FK50EB77F181D8C3F6")]
        [DebuggerNonUserCode()]
        public EntitySet<TBusStaffMan> TBusStaffMan
        {
            get
            {
                return this._tbUsStaffMan;
            }
            set
            {
                this._tbUsStaffMan = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TBusStaffMan_Attach(TBusStaffMan entity)
        {
            this.SendPropertyChanging();
            entity.TStaffType = this;
        }

        private void TBusStaffMan_Detach(TBusStaffMan entity)
        {
            this.SendPropertyChanging();
            entity.TStaffType = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_student")]
    public partial class TStudent : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _birthday;

        private System.Nullable<System.DateTime> _createTime;

        private string _createUser;

        private string _email;

        private int _id;

        private string _imagePath;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _phone;

        private string _sex;

        private string _sort;

        private System.Nullable<int> _stafftypeID;

        private string _staffTypeName;

        private string _studentNum;

        private string _studName;

        private string _studNum;

        private System.Nullable<System.DateTime> _updateTime;

        private string _updateUser;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBirthdayChanged();

        partial void OnBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(string value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnStaffTypeNameChanged();

        partial void OnStaffTypeNameChanging(string value);

        partial void OnStudentNumChanged();

        partial void OnStudentNumChanging(string value);

        partial void OnStudNameChanged();

        partial void OnStudNameChanging(string value);

        partial void OnStudNumChanged();

        partial void OnStudNumChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(string value);
        #endregion


        public TStudent()
        {
            this.OnCreated();
        }

        [Column(Storage = "_birthday", Name = "birthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> Birthday
        {
            get
            {
                return this._birthday;
            }
            set
            {
                if ((_birthday != value))
                {
                    this.OnBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._birthday = value;
                    this.SendPropertyChanged("Birthday");
                    this.OnBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if (((_createUser == value)
                            == false))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_staffTypeName", Name = "staffTypeName", DbType = "varchar(30)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffTypeName
        {
            get
            {
                return this._staffTypeName;
            }
            set
            {
                if (((_staffTypeName == value)
                            == false))
                {
                    this.OnStaffTypeNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffTypeName = value;
                    this.SendPropertyChanged("StaffTypeName");
                    this.OnStaffTypeNameChanged();
                }
            }
        }

        [Column(Storage = "_studentNum", Name = "studentNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StudentNum
        {
            get
            {
                return this._studentNum;
            }
            set
            {
                if (((_studentNum == value)
                            == false))
                {
                    this.OnStudentNumChanging(value);
                    this.SendPropertyChanging();
                    this._studentNum = value;
                    this.SendPropertyChanged("StudentNum");
                    this.OnStudentNumChanged();
                }
            }
        }

        [Column(Storage = "_studName", Name = "studName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StudName
        {
            get
            {
                return this._studName;
            }
            set
            {
                if (((_studName == value)
                            == false))
                {
                    this.OnStudNameChanging(value);
                    this.SendPropertyChanging();
                    this._studName = value;
                    this.SendPropertyChanged("StudName");
                    this.OnStudNameChanged();
                }
            }
        }

        [Column(Storage = "_studNum", Name = "studNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StudNum
        {
            get
            {
                return this._studNum;
            }
            set
            {
                if (((_studNum == value)
                            == false))
                {
                    this.OnStudNumChanging(value);
                    this.SendPropertyChanging();
                    this._studNum = value;
                    this.SendPropertyChanged("StudNum");
                    this.OnStudNumChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if (((_updateUser == value)
                            == false))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_student_card_owner")]
    public partial class TStudentCardOwner : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<long> _cardCode;

        private int _id;

        private System.Nullable<int> _studentID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardCodeChanged();

        partial void OnCardCodeChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnStudentIDChanged();

        partial void OnStudentIDChanging(System.Nullable<int> value);
        #endregion


        public TStudentCardOwner()
        {
            this.OnCreated();
        }

        [Column(Storage = "_cardCode", Name = "cardCode", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardCode
        {
            get
            {
                return this._cardCode;
            }
            set
            {
                if ((_cardCode != value))
                {
                    this.OnCardCodeChanging(value);
                    this.SendPropertyChanging();
                    this._cardCode = value;
                    this.SendPropertyChanged("CardCode");
                    this.OnCardCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_studentID", Name = "studentId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StudentID
        {
            get
            {
                return this._studentID;
            }
            set
            {
                if ((_studentID != value))
                {
                    this.OnStudentIDChanging(value);
                    this.SendPropertyChanging();
                    this._studentID = value;
                    this.SendPropertyChanged("StudentID");
                    this.OnStudentIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_teacher")]
    public partial class TTeacher : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _birthday;

        private System.Nullable<System.DateTime> _createTime;

        private string _createUser;

        private string _email;

        private int _id;

        private string _identityNum;

        private string _imagePath;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _phone;

        private string _sex;

        private string _sort;

        private System.Nullable<int> _stafftypeID;

        private string _staffTypeName;

        private System.Nullable<int> _state;

        private string _teacherName;

        private string _teacherNum;

        private System.Nullable<System.DateTime> _updateTime;

        private string _updateUser;

        private EntitySet<TGivenClass> _tgIvenClass;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnBirthdayChanged();

        partial void OnBirthdayChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(string value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnIdentityNumChanged();

        partial void OnIdentityNumChanging(string value);

        partial void OnImagePathChanged();

        partial void OnImagePathChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPhoneChanged();

        partial void OnPhoneChanging(string value);

        partial void OnSexChanged();

        partial void OnSexChanging(string value);

        partial void OnSortChanged();

        partial void OnSortChanging(string value);

        partial void OnStafftypeIDChanged();

        partial void OnStafftypeIDChanging(System.Nullable<int> value);

        partial void OnStaffTypeNameChanged();

        partial void OnStaffTypeNameChanging(string value);

        partial void OnStateChanged();

        partial void OnStateChanging(System.Nullable<int> value);

        partial void OnTeacherNameChanged();

        partial void OnTeacherNameChanging(string value);

        partial void OnTeacherNumChanged();

        partial void OnTeacherNumChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(string value);
        #endregion


        public TTeacher()
        {
            _tgIvenClass = new EntitySet<TGivenClass>(new Action<TGivenClass>(this.TGivenClass_Attach), new Action<TGivenClass>(this.TGivenClass_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_birthday", Name = "birthday", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> Birthday
        {
            get
            {
                return this._birthday;
            }
            set
            {
                if ((_birthday != value))
                {
                    this.OnBirthdayChanging(value);
                    this.SendPropertyChanging();
                    this._birthday = value;
                    this.SendPropertyChanged("Birthday");
                    this.OnBirthdayChanged();
                }
            }
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if (((_createUser == value)
                            == false))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_identityNum", Name = "identityNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string IdentityNum
        {
            get
            {
                return this._identityNum;
            }
            set
            {
                if (((_identityNum == value)
                            == false))
                {
                    this.OnIdentityNumChanging(value);
                    this.SendPropertyChanging();
                    this._identityNum = value;
                    this.SendPropertyChanged("IdentityNum");
                    this.OnIdentityNumChanged();
                }
            }
        }

        [Column(Storage = "_imagePath", Name = "imagePath", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string ImagePath
        {
            get
            {
                return this._imagePath;
            }
            set
            {
                if (((_imagePath == value)
                            == false))
                {
                    this.OnImagePathChanging(value);
                    this.SendPropertyChanging();
                    this._imagePath = value;
                    this.SendPropertyChanged("ImagePath");
                    this.OnImagePathChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_phone", Name = "phone", DbType = "varchar(25)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if (((_phone == value)
                            == false))
                {
                    this.OnPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._phone = value;
                    this.SendPropertyChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }

        [Column(Storage = "_sex", Name = "sex", DbType = "varchar(4)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sex
        {
            get
            {
                return this._sex;
            }
            set
            {
                if (((_sex == value)
                            == false))
                {
                    this.OnSexChanging(value);
                    this.SendPropertyChanging();
                    this._sex = value;
                    this.SendPropertyChanged("Sex");
                    this.OnSexChanged();
                }
            }
        }

        [Column(Storage = "_sort", Name = "sort", DbType = "varchar(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Sort
        {
            get
            {
                return this._sort;
            }
            set
            {
                if (((_sort == value)
                            == false))
                {
                    this.OnSortChanging(value);
                    this.SendPropertyChanging();
                    this._sort = value;
                    this.SendPropertyChanged("Sort");
                    this.OnSortChanged();
                }
            }
        }

        [Column(Storage = "_stafftypeID", Name = "stafftypeId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> StafftypeID
        {
            get
            {
                return this._stafftypeID;
            }
            set
            {
                if ((_stafftypeID != value))
                {
                    this.OnStafftypeIDChanging(value);
                    this.SendPropertyChanging();
                    this._stafftypeID = value;
                    this.SendPropertyChanged("StafftypeID");
                    this.OnStafftypeIDChanged();
                }
            }
        }

        [Column(Storage = "_staffTypeName", Name = "staffTypeName", DbType = "varchar(30)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string StaffTypeName
        {
            get
            {
                return this._staffTypeName;
            }
            set
            {
                if (((_staffTypeName == value)
                            == false))
                {
                    this.OnStaffTypeNameChanging(value);
                    this.SendPropertyChanging();
                    this._staffTypeName = value;
                    this.SendPropertyChanged("StaffTypeName");
                    this.OnStaffTypeNameChanged();
                }
            }
        }

        [Column(Storage = "_state", Name = "state", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> State
        {
            get
            {
                return this._state;
            }
            set
            {
                if ((_state != value))
                {
                    this.OnStateChanging(value);
                    this.SendPropertyChanging();
                    this._state = value;
                    this.SendPropertyChanged("State");
                    this.OnStateChanged();
                }
            }
        }

        [Column(Storage = "_teacherName", Name = "teacherName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string TeacherName
        {
            get
            {
                return this._teacherName;
            }
            set
            {
                if (((_teacherName == value)
                            == false))
                {
                    this.OnTeacherNameChanging(value);
                    this.SendPropertyChanging();
                    this._teacherName = value;
                    this.SendPropertyChanged("TeacherName");
                    this.OnTeacherNameChanged();
                }
            }
        }

        [Column(Storage = "_teacherNum", Name = "teacherNum", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string TeacherNum
        {
            get
            {
                return this._teacherNum;
            }
            set
            {
                if (((_teacherNum == value)
                            == false))
                {
                    this.OnTeacherNumChanging(value);
                    this.SendPropertyChanging();
                    this._teacherNum = value;
                    this.SendPropertyChanged("TeacherNum");
                    this.OnTeacherNumChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if (((_updateUser == value)
                            == false))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tgIvenClass", OtherKey = "TeacherID", ThisKey = "ID", Name = "FKBE8002EB245C591A")]
        [DebuggerNonUserCode()]
        public EntitySet<TGivenClass> TGivenClass
        {
            get
            {
                return this._tgIvenClass;
            }
            set
            {
                this._tgIvenClass = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TGivenClass_Attach(TGivenClass entity)
        {
            this.SendPropertyChanging();
            entity.TTeacher = this;
        }

        private void TGivenClass_Detach(TGivenClass entity)
        {
            this.SendPropertyChanging();
            entity.TTeacher = null;
        }
        #endregion
    }

    [Table(Name = "schoolbus.t_teacher_card_owner")]
    public partial class TTeacherCardOwner : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<long> _cardCode;

        private int _id;

        private System.Nullable<int> _teacherID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCardCodeChanged();

        partial void OnCardCodeChanging(System.Nullable<long> value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnTeacherIDChanged();

        partial void OnTeacherIDChanging(System.Nullable<int> value);
        #endregion


        public TTeacherCardOwner()
        {
            this.OnCreated();
        }

        [Column(Storage = "_cardCode", Name = "cardCode", DbType = "bigint(255)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CardCode
        {
            get
            {
                return this._cardCode;
            }
            set
            {
                if ((_cardCode != value))
                {
                    this.OnCardCodeChanging(value);
                    this.SendPropertyChanging();
                    this._cardCode = value;
                    this.SendPropertyChanged("CardCode");
                    this.OnCardCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_teacherID", Name = "teacherId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> TeacherID
        {
            get
            {
                return this._teacherID;
            }
            set
            {
                if ((_teacherID != value))
                {
                    this.OnTeacherIDChanging(value);
                    this.SendPropertyChanging();
                    this._teacherID = value;
                    this.SendPropertyChanged("TeacherID");
                    this.OnTeacherIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_user")]
    public partial class TUser : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private System.Nullable<System.DateTime> _createTime;

        private System.Nullable<long> _createUser;

        private System.Nullable<long> _createUserID;

        private string _email;

        private System.Nullable<bool> _enabled;

        private System.Nullable<System.DateTime> _enableTime;

        private int _id;

        private System.Nullable<bool> _isSys;

        private System.Nullable<System.DateTime> _lastLogTime;

        private string _loginName;

        private string _name;

        private string _note;

        private System.Nullable<int> _orgID;

        private string _password;

        private string _tattedCode;

        private System.Nullable<System.DateTime> _updateTime;

        private System.Nullable<long> _updateUser;

        private System.Nullable<long> _updateUserID;

        private System.Nullable<int> _userType;

        private EntitySet<TLog> _tlOg;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCreateTimeChanged();

        partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnCreateUserChanged();

        partial void OnCreateUserChanging(System.Nullable<long> value);

        partial void OnCreateUserIDChanged();

        partial void OnCreateUserIDChanging(System.Nullable<long> value);

        partial void OnEmailChanged();

        partial void OnEmailChanging(string value);

        partial void OnEnabledChanged();

        partial void OnEnabledChanging(System.Nullable<bool> value);

        partial void OnEnableTimeChanged();

        partial void OnEnableTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnIDChanged();

        partial void OnIDChanging(long value);

        partial void OnIsSysChanged();

        partial void OnIsSysChanging(System.Nullable<bool> value);

        partial void OnLastLogTimeChanged();

        partial void OnLastLogTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnLoginNameChanged();

        partial void OnLoginNameChanging(string value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(System.Nullable<int> value);

        partial void OnPasswordChanged();

        partial void OnPasswordChanging(string value);

        partial void OnTattedCodeChanged();

        partial void OnTattedCodeChanging(string value);

        partial void OnUpdateTimeChanged();

        partial void OnUpdateTimeChanging(System.Nullable<System.DateTime> value);

        partial void OnUpdateUserChanged();

        partial void OnUpdateUserChanging(System.Nullable<long> value);

        partial void OnUpdateUserIDChanged();

        partial void OnUpdateUserIDChanging(System.Nullable<long> value);

        partial void OnUserTypeChanged();

        partial void OnUserTypeChanging(System.Nullable<int> value);
        #endregion


        public TUser()
        {
            _tlOg = new EntitySet<TLog>(new Action<TLog>(this.TLog_Attach), new Action<TLog>(this.TLog_Detach));
            this.OnCreated();
        }

        [Column(Storage = "_createTime", Name = "createTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> CreateTime
        {
            get
            {
                return this._createTime;
            }
            set
            {
                if ((_createTime != value))
                {
                    this.OnCreateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._createTime = value;
                    this.SendPropertyChanged("CreateTime");
                    this.OnCreateTimeChanged();
                }
            }
        }

        [Column(Storage = "_createUser", Name = "createUser", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                if ((_createUser != value))
                {
                    this.OnCreateUserChanging(value);
                    this.SendPropertyChanging();
                    this._createUser = value;
                    this.SendPropertyChanged("CreateUser");
                    this.OnCreateUserChanged();
                }
            }
        }

        [Column(Storage = "_createUserID", Name = "createUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> CreateUserID
        {
            get
            {
                return this._createUserID;
            }
            set
            {
                if ((_createUserID != value))
                {
                    this.OnCreateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._createUserID = value;
                    this.SendPropertyChanged("CreateUserID");
                    this.OnCreateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_email", Name = "email", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if (((_email == value)
                            == false))
                {
                    this.OnEmailChanging(value);
                    this.SendPropertyChanging();
                    this._email = value;
                    this.SendPropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }

        [Column(Storage = "_enabled", Name = "enabled", DbType = "bit(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<bool> Enabled
        {
            get
            {
                return this._enabled;
            }
            set
            {
                if ((_enabled != value))
                {
                    this.OnEnabledChanging(value);
                    this.SendPropertyChanging();
                    this._enabled = value;
                    this.SendPropertyChanged("Enabled");
                    this.OnEnabledChanged();
                }
            }
        }

        [Column(Storage = "_enableTime", Name = "enableTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> EnableTime
        {
            get
            {
                return this._enableTime;
            }
            set
            {
                if ((_enableTime != value))
                {
                    this.OnEnableTimeChanging(value);
                    this.SendPropertyChanging();
                    this._enableTime = value;
                    this.SendPropertyChanged("EnableTime");
                    this.OnEnableTimeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int(11)", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_isSys", Name = "isSys", DbType = "bit(1)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<bool> IsSys
        {
            get
            {
                return this._isSys;
            }
            set
            {
                if ((_isSys != value))
                {
                    this.OnIsSysChanging(value);
                    this.SendPropertyChanging();
                    this._isSys = value;
                    this.SendPropertyChanged("IsSys");
                    this.OnIsSysChanged();
                }
            }
        }

        [Column(Storage = "_lastLogTime", Name = "lastLogTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> LastLogTime
        {
            get
            {
                return this._lastLogTime;
            }
            set
            {
                if ((_lastLogTime != value))
                {
                    this.OnLastLogTimeChanging(value);
                    this.SendPropertyChanging();
                    this._lastLogTime = value;
                    this.SendPropertyChanged("LastLogTime");
                    this.OnLastLogTimeChanged();
                }
            }
        }

        [Column(Storage = "_loginName", Name = "loginName", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string LoginName
        {
            get
            {
                return this._loginName;
            }
            set
            {
                if (((_loginName == value)
                            == false))
                {
                    this.OnLoginNameChanging(value);
                    this.SendPropertyChanging();
                    this._loginName = value;
                    this.SendPropertyChanged("LoginName");
                    this.OnLoginNameChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_password", Name = "password", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Password
        {
            get
            {
                return this._password;
            }
            set
            {
                if (((_password == value)
                            == false))
                {
                    this.OnPasswordChanging(value);
                    this.SendPropertyChanging();
                    this._password = value;
                    this.SendPropertyChanged("Password");
                    this.OnPasswordChanged();
                }
            }
        }

        [Column(Storage = "_tattedCode", Name = "tattedCode", DbType = "varchar(50)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string TattedCode
        {
            get
            {
                return this._tattedCode;
            }
            set
            {
                if (((_tattedCode == value)
                            == false))
                {
                    this.OnTattedCodeChanging(value);
                    this.SendPropertyChanging();
                    this._tattedCode = value;
                    this.SendPropertyChanged("TattedCode");
                    this.OnTattedCodeChanged();
                }
            }
        }

        [Column(Storage = "_updateTime", Name = "updateTime", DbType = "datetime", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<System.DateTime> UpdateTime
        {
            get
            {
                return this._updateTime;
            }
            set
            {
                if ((_updateTime != value))
                {
                    this.OnUpdateTimeChanging(value);
                    this.SendPropertyChanging();
                    this._updateTime = value;
                    this.SendPropertyChanged("UpdateTime");
                    this.OnUpdateTimeChanged();
                }
            }
        }

        [Column(Storage = "_updateUser", Name = "updateUser", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> UpdateUser
        {
            get
            {
                return this._updateUser;
            }
            set
            {
                if ((_updateUser != value))
                {
                    this.OnUpdateUserChanging(value);
                    this.SendPropertyChanging();
                    this._updateUser = value;
                    this.SendPropertyChanged("UpdateUser");
                    this.OnUpdateUserChanged();
                }
            }
        }

        [Column(Storage = "_updateUserID", Name = "updateUserId", DbType = "bigint(20)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<long> UpdateUserID
        {
            get
            {
                return this._updateUserID;
            }
            set
            {
                if ((_updateUserID != value))
                {
                    this.OnUpdateUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._updateUserID = value;
                    this.SendPropertyChanged("UpdateUserID");
                    this.OnUpdateUserIDChanged();
                }
            }
        }

        [Column(Storage = "_userType", Name = "userType", DbType = "int", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public System.Nullable<int> UserType
        {
            get
            {
                return this._userType;
            }
            set
            {
                if ((_userType != value))
                {
                    this.OnUserTypeChanging(value);
                    this.SendPropertyChanging();
                    this._userType = value;
                    this.SendPropertyChanged("UserType");
                    this.OnUserTypeChanged();
                }
            }
        }

        #region Children
        [Association(Storage = "_tlOg", OtherKey = "UserID", ThisKey = "LoginName", Name = "FKCFF9B92758D78B32")]
        [DebuggerNonUserCode()]
        public EntitySet<TLog> TLog
        {
            get
            {
                return this._tlOg;
            }
            set
            {
                this._tlOg = value;
            }
        }
        #endregion

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        #region Attachment handlers
        private void TLog_Attach(TLog entity)
        {
            this.SendPropertyChanging();
            entity.TUser = this;
        }

        private void TLog_Detach(TLog entity)
        {
            this.SendPropertyChanging();
            entity.TUser = null;
        }
        #endregion
    }


    [Table(Name = "schoolbus.t_user_org")]
    public partial class TUserOrG : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _orgID;

        private int _userID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnOrgIDChanged();

        partial void OnOrgIDChanging(int value);

        partial void OnUserIDChanged();

        partial void OnUserIDChanging(long value);
        #endregion


        public TUserOrG()
        {
            this.OnCreated();
        }

        [Column(Storage = "_orgID", Name = "orgId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int OrgID
        {
            get
            {
                return this._orgID;
            }
            set
            {
                if ((_orgID != value))
                {
                    this.OnOrgIDChanging(value);
                    this.SendPropertyChanging();
                    this._orgID = value;
                    this.SendPropertyChanged("OrgID");
                    this.OnOrgIDChanged();
                }
            }
        }

        [Column(Storage = "_userID", Name = "userId", DbType = "int(11)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int UserID
        {
            get
            {
                return this._userID;
            }
            set
            {
                if ((_userID != value))
                {
                    this.OnUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._userID = value;
                    this.SendPropertyChanged("UserID");
                    this.OnUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_user_privilege")]
    public partial class TUserPrivilege : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _privilegeID;

        private int _userID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnPrivilegeIDChanged();

        partial void OnPrivilegeIDChanging(int value);

        partial void OnUserIDChanged();

        partial void OnUserIDChanging(long value);
        #endregion


        public TUserPrivilege()
        {
            this.OnCreated();
        }

        [Column(Storage = "_privilegeID", Name = "privilegeId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int PrivilegeID
        {
            get
            {
                return this._privilegeID;
            }
            set
            {
                if ((_privilegeID != value))
                {
                    this.OnPrivilegeIDChanging(value);
                    this.SendPropertyChanging();
                    this._privilegeID = value;
                    this.SendPropertyChanged("PrivilegeID");
                    this.OnPrivilegeIDChanged();
                }
            }
        }

        [Column(Storage = "_userID", Name = "userId", DbType = "int(11)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int UserID
        {
            get
            {
                return this._userID;
            }
            set
            {
                if ((_userID != value))
                {
                    this.OnUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._userID = value;
                    this.SendPropertyChanged("UserID");
                    this.OnUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_user_role")]
    public partial class TUserRole : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private int _roleID;

        private int _userID;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnRoleIDChanged();

        partial void OnRoleIDChanging(int value);

        partial void OnUserIDChanged();

        partial void OnUserIDChanging(long value);
        #endregion


        public TUserRole()
        {
            this.OnCreated();
        }

        [Column(Storage = "_roleID", Name = "roleId", DbType = "int", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int RoleID
        {
            get
            {
                return this._roleID;
            }
            set
            {
                if ((_roleID != value))
                {
                    this.OnRoleIDChanging(value);
                    this.SendPropertyChanging();
                    this._roleID = value;
                    this.SendPropertyChanged("RoleID");
                    this.OnRoleIDChanged();
                }
            }
        }

        [Column(Storage = "_userID", Name = "userId", DbType = "int(11)", IsPrimaryKey = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int UserID
        {
            get
            {
                return this._userID;
            }
            set
            {
                if ((_userID != value))
                {
                    this.OnUserIDChanging(value);
                    this.SendPropertyChanging();
                    this._userID = value;
                    this.SendPropertyChanged("UserID");
                    this.OnUserIDChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [Table(Name = "schoolbus.t_usertype")]
    public partial class TUserType : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
    {

        private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new System.ComponentModel.PropertyChangingEventArgs("");

        private string _code;

        private int _id;

        private string _name;

        private string _note;

        #region Extensibility Method Declarations
        partial void OnCreated();

        partial void OnCodeChanged();

        partial void OnCodeChanging(string value);

        partial void OnIDChanged();

        partial void OnIDChanging(int value);

        partial void OnNameChanged();

        partial void OnNameChanging(string value);

        partial void OnNoteChanged();

        partial void OnNoteChanging(string value);
        #endregion


        public TUserType()
        {
            this.OnCreated();
        }

        [Column(Storage = "_code", Name = "code", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Code
        {
            get
            {
                return this._code;
            }
            set
            {
                if (((_code == value)
                            == false))
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        [Column(Storage = "_id", Name = "id", DbType = "int", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((_id != value))
                {
                    this.OnIDChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("ID");
                    this.OnIDChanged();
                }
            }
        }

        [Column(Storage = "_name", Name = "name", DbType = "varchar(20)", AutoSync = AutoSync.Never, CanBeNull = false)]
        [DebuggerNonUserCode()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if (((_name == value)
                            == false))
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        [Column(Storage = "_note", Name = "note", DbType = "varchar(100)", AutoSync = AutoSync.Never)]
        [DebuggerNonUserCode()]
        public string Note
        {
            get
            {
                return this._note;
            }
            set
            {
                if (((_note == value)
                            == false))
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            System.ComponentModel.PropertyChangingEventHandler h = this.PropertyChanging;
            if ((h != null))
            {
                h(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(string propertyName)
        {
            System.ComponentModel.PropertyChangedEventHandler h = this.PropertyChanged;
            if ((h != null))
            {
                h(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
